About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 Y/ }: p7 x: b4 u. O5 k! A
<TBODY>
* L0 Y) f) x- E! _<TR>
6 m) x! W2 S) O" y0 u) v<TD><PRE>Method 01
3 s" `/ {9 S5 l=========" r1 \3 b) J, K

0 r1 R9 B  H  zThis method of detection of SoftICE (as well as the following one) is! H/ _1 {, \: [6 F( t
used by the majority of packers/encryptors found on Internet.0 O0 R) X" `- J9 u% b5 j' S$ R
It seeks the signature of BoundsChecker in SoftICE
2 h# X# L" l! ^" e9 q7 I
$ B8 G5 l- z# T9 L    mov     ebp, 04243484Bh        ; 'BCHK'& E2 |% t: C$ M
    mov     ax, 04h
* {4 I6 {  l8 ?" F    int     3       + Q( |8 r  p; |( y8 f5 X, T
    cmp     al,4; ~! n% o; F8 _" W) _2 f* F1 }
    jnz     SoftICE_Detected# f5 V, c7 t/ j7 x& O! h2 e9 k% I

7 R8 @  ?4 S* J___________________________________________________________________________
' _1 @' Z( f! X2 L: I  \8 o) a/ Z2 e  c% i/ z1 t$ Q8 {
Method 02" m  Q' ~1 u- n+ s
=========6 g% D  c6 |# k' \5 d6 V0 e) o
1 }6 t+ D" @* G
Still a method very much used (perhaps the most frequent one).  It is used
5 T9 i9 c- i( R/ z! oto get SoftICE 'Back Door commands' which gives infos on Breakpoints,: y& ^4 P6 B, V' m9 Q8 y4 o
or execute SoftICE commands...# L4 }8 P5 B& o# p- y$ D# k! Y# c0 m
It is also used to crash SoftICE and to force it to execute any commands
" H& n- b1 o3 ~  z- d: H4 W' J- }(HBOOT...) :-((  / i  j$ {# G' Y# n, k, c% M2 i

/ b* d5 x& H; O/ O6 @# |Here is a quick description:
( ?. |: J- q' u  @" O-AX = 0910h   (Display string in SIce windows)
6 o$ `0 I( W/ B# H7 n* P-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* O$ Y4 l% d6 k9 N9 M5 q-AX = 0912h   (Get breakpoint infos)9 J) _: S/ H8 z1 \) u6 m1 k
-AX = 0913h   (Set Sice breakpoints)" Z  S# z2 l2 |8 r
-AX = 0914h   (Remove SIce breakoints)1 U, {% M  A" @! e9 W+ g. ^

/ X" C; B9 L  v; U- y8 r( `Each time you'll meet this trick, you'll see:. H3 [7 y7 c1 p6 Q7 m3 {
-SI = 4647h
% W& _; o8 o8 Y% c' J-DI = 4A4Dh- X# g6 x! R( s; b( {/ p
Which are the 'magic values' used by SoftIce.# K1 `: q  j7 z% Z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# G' }2 B/ R9 h) N4 q3 R' t
1 A2 u# ?' ]. _% ]/ OHere is one example from the file "Haspinst.exe" which is the dongle HASP
- q- v5 R- F- n7 T, R' dEnvelope utility use to protect DOS applications:. u  r/ p5 x  X- |& X2 F

( L: y) ~9 \7 K- i- m, t0 s; s7 D3 x* L
4C19:0095   MOV    AX,0911  ; execute command.1 A, ^, X9 a' L7 ~2 _2 h
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 y/ H  l& u, ^4C19:009A   MOV    SI,4647  ; 1st magic value.
6 e. T: \, N( W9 i4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 V) h5 m9 L; V! v: l1 w% P$ B
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ V7 e, C9 \& Y7 T& v; _9 l' J4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) r$ P8 u; I# [+ K
4C19:00A4   INC    CX
! ]9 L2 d5 L4 m! o* K4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- r  Z# h! _2 v1 K9 d' k( u* Y, x$ C9 G
4C19:00A8   JB     0095     ; 6 different commands.
* o7 m5 V) K% z3 M5 N4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# ]2 r7 L/ _$ f3 P4 M' U/ C
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' F1 T% y4 r2 o( y7 g1 _( t2 S8 s6 f! `) I- y" V$ p% `1 c# A
The program will execute 6 different SIce commands located at ds:dx, which
! z! d5 z/ k0 k" ^$ }) U/ i! Vare: LDT, IDT, GDT, TSS, RS, and ...HBOOT., a6 k  m7 v" [* n$ ~  t: O% G

* ^+ |* u. s3 `; c& w; u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.( m% z! B9 h9 g% o
___________________________________________________________________________
2 f" w4 H, Z+ o0 d, k! j0 b4 H+ j/ G% `- s9 a' p

2 L( w" E" K& U1 t! eMethod 03
7 N0 T! i2 K9 W, H* r/ i" L=========" @. {. ]! x+ ~6 T4 Y& K$ X
2 H  o  d! t- L  Z* M
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 D( w0 e/ i3 C& s(API Get entry point)- Z% N$ t4 z3 G$ Q6 {
        & Y0 p9 ~3 w  Y/ ~; a
' e8 Y3 o6 ^5 L; I
    xor     di,di3 b# I% [/ A! z
    mov     es,di# s; `0 t3 H4 ^6 ~
    mov     ax, 1684h      
4 G0 T4 `2 ]: w/ e% b! v2 E6 Y, Q    mov     bx, 0202h       ; VxD ID of winice- v3 b, l, u2 k" E0 j' h: ~
    int     2Fh* L! Y# K1 B# p7 Z9 F  `. S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  U& |' r" Z; @, |* j& O. {
    add     ax, di; _3 H  T3 H8 E: k( n: t/ d
    test    ax,ax
: M) f- H( j: P6 B$ w    jnz     SoftICE_Detected
8 u& j. |8 u8 m  @3 ~( z
; m+ B/ ?, ?  `6 p. u( P___________________________________________________________________________( E2 n, ~7 t1 t
, R" O$ C2 ]/ M
Method 04# m* i* u" `3 n& E( I0 K0 o5 Y, l: ^2 s
=========1 v% ^- c9 d% `. h

. X5 M) N1 Y6 F+ G7 @, `/ qMethod identical to the preceding one except that it seeks the ID of SoftICE
1 I- X# @: ]- L$ r, V9 i& RGFX VxD.
# v3 o+ S: Z/ O9 l9 v8 t( E  o  @
/ o. r+ a* _" V0 \0 C8 v6 ~    xor     di,di
$ }* d3 e; R7 ?2 J    mov     es,di/ i4 J/ C6 b9 V# g
    mov     ax, 1684h      
- O) V/ \6 H0 T, x3 T1 I3 E: |    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, e! O- U% @8 P    int     2fh
0 h; u' z, \( j    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 S0 g, ^. N' h
    add     ax, di- e% q, h& O  {2 k7 b: ?8 y# U% l
    test    ax,ax5 G# l8 X. {" l- S1 R$ K9 u
    jnz     SoftICE_Detected
3 q7 v3 i, @! t1 ~: j, [2 `8 B! r
# t% Q  P9 h/ i0 D; o8 Z5 e__________________________________________________________________________- b% c9 ~5 G6 l

2 @2 `. g/ w. T) M) O9 p( T& i6 p
Method 05
' f; [8 D/ g" T  M3 L! s: Y( [=========# o2 ]+ W* }4 ]) ]! ]- s( V- E

3 E& z" @1 L/ e. L; S; F  ]Method seeking the 'magic number' 0F386h returned (in ax) by all system/ ?* H+ m: V& y5 T; i
debugger. It calls the int 41h, function 4Fh., v; N% w+ P5 j; G
There are several alternatives.  1 O9 C" X* b+ b& d

2 P% J# M1 r6 ]4 L& s. q! Z/ GThe following one is the simplest:
+ i$ y/ g$ A# s/ M+ K) h! U2 q% ?/ O" k/ e9 K" n3 {1 L
    mov     ax,4fh
9 [, X! z. _5 J    int     41h1 r! P4 m3 W* T; L6 I5 L7 C1 r
    cmp     ax, 0F386$ H* ?2 u! L. D
    jz      SoftICE_detected$ X7 j6 L# [: r; e: t1 }& F
- H; s" r: o% I0 ?  F8 [
* q3 w1 U% T. G5 R' ]. w( b* w
Next method as well as the following one are 2 examples from Stone's
6 f& h4 \/ L- v: q' i) [) d0 w"stn-wid.zip" (www.cracking.net):0 U; P3 X; J; E/ ?

' c  F% a- ^- T9 N    mov     bx, cs1 n) u" x0 N0 i' R+ ]: C7 g
    lea     dx, int41handler2
4 N# |, ~3 R+ u& Y2 ?    xchg    dx, es:[41h*4]# T8 X# H6 }: f+ |+ m( ]3 c
    xchg    bx, es:[41h*4+2]
/ ?" X- t( ]& `  N/ v# a: f    mov     ax,4fh; f1 h  O0 J( P" K! {: W  W
    int     41h- b: |% [) ^! E5 D! M
    xchg    dx, es:[41h*4]- G1 X: D4 k# y& E) j% I
    xchg    bx, es:[41h*4+2]. Q% X) s) _8 _+ P, M% ?0 q
    cmp     ax, 0f386h  }* M1 I8 K, Q& F7 L0 k5 s7 s
    jz      SoftICE_detected
0 r. s5 Z1 D: U+ I% a6 p' H- @: w  z; S  W( k1 d8 v# N8 P
int41handler2 PROC
7 L5 t5 Y- r* X, |- q* W/ w) [    iret2 S% x9 d2 C8 n# a
int41handler2 ENDP5 }/ X* K7 D& q, C
. t( p- w6 b+ y2 k/ d8 U

$ g6 B1 \# Q! |# {( D_________________________________________________________________________8 [4 _  T0 H6 B+ r' x

' B6 x6 N+ `7 u) U2 ]$ e" t8 ~. V- ]$ U' D
Method 06
- ], ]2 B2 y0 q: ~=========! G2 H7 K  n  N/ |9 `+ s  |: r/ n

* w7 a3 l( \7 @2 N
/ b9 T7 w4 U% c2nd method similar to the preceding one but more difficult to detect:
# @7 s( I! `  c: `
, i* y1 R+ O( {) W! g# I9 {
4 Q" ?- V8 T$ L. Hint41handler PROC' g% n- _8 J* B
    mov     cl,al! ^/ y* ^6 |/ {: v- f/ [
    iret
# X: j+ {: v0 S6 z7 [; M: r$ [% [int41handler ENDP
8 L% h  e- W+ x$ c& m1 p  |4 z
/ _$ F' @5 S: f* l* T- S. P: U( j2 L! h6 [% ]" c6 _/ J
    xor     ax,ax1 i: o3 _* d* l) j- C- W1 w$ d/ Y
    mov     es,ax
9 j4 ~: M! i& X4 g+ N    mov     bx, cs5 {( R4 `- o0 Y5 o+ k
    lea     dx, int41handler/ M! o& i0 u" X/ }8 T7 M( ^
    xchg    dx, es:[41h*4]  k' ^$ r$ X0 x6 d3 m7 ]7 R
    xchg    bx, es:[41h*4+2]8 g( a# p/ d4 l
    in      al, 40h1 K4 C& k! M% v+ x/ `8 q
    xor     cx,cx6 _6 B6 r& o! Q  G& Z8 H
    int     41h+ `' x$ }3 j  W" S% W! p7 m- u6 I
    xchg    dx, es:[41h*4]: ^+ M" `" K. b' F% w* x. m. Q1 l
    xchg    bx, es:[41h*4+2]; u1 ^' \0 }3 B( P
    cmp     cl,al/ G- A3 _  v! p. ~% }' j/ z9 k9 t
    jnz     SoftICE_detected
4 R0 R: d; F5 H6 ^% i
+ H3 j. R7 @) p4 @/ k_________________________________________________________________________
" i; t' I4 {5 d+ I' R; ]& l1 g
Method 07
& L; s& |! k. [0 v& b* t=========
# `, u# i) V7 @: H; [/ u" i8 M
! r: M/ K% o- D" \+ o3 PMethod of detection of the WinICE handler in the int68h (V86). @. M2 \8 G( p+ y: p, R/ r! p

/ R# S) k3 G9 a    mov     ah,43h
, u6 h3 W6 U4 f5 s    int     68h" V; h/ K! Y5 l0 f4 W1 _
    cmp     ax,0F386h
+ f0 s% C0 _  J, u# x9 P    jz      SoftICE_Detected, [  ?. _; B. K- y

2 N! I3 O9 I  T
2 G" d" v7 t' o$ D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 N8 T) Y. a' j+ H. E. b
   app like this:
9 e+ g. @) h9 e* q3 s; V
  c; F3 v8 Y6 c$ O  U   BPX exec_int if ax==68
' N. z" I# I7 }' G   (function called is located at byte ptr [ebp+1Dh] and client eip is- Y- D2 B+ j  K0 q% f
   located at [ebp+48h] for 32Bit apps): E* U) P/ |, ~. I$ L, M) \" X
__________________________________________________________________________
6 N# n4 e6 A, d2 M% C9 H( d! ]) t/ d- p/ t5 v/ k" i! O5 A
+ M- _# o; [! P! a! |
Method 080 C! H1 L) V4 E  l
=========
6 H1 i1 d' K% A; {! A9 ^$ W. F) P- o
It is not a method of detection of SoftICE but a possibility to crash the
9 h: l0 |8 w4 W" n1 R$ Osystem by intercepting int 01h and int 03h and redirecting them to another
2 u1 G" A( N5 T% O" Lroutine.
8 S! ^$ G, ~- T& v4 QIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 i9 @/ `, x. a7 N  Cto the new routine to execute (hangs computer...)
3 o3 o8 t; ^) t) w5 |+ [3 ]7 |1 Z6 R( J3 c+ P! p
    mov     ah, 25h
8 N+ T0 w. D: D* G1 \1 j3 A2 q  h3 w    mov     al, Int_Number (01h or 03h)2 h, g' T/ |4 k3 h: ?) b, ]# n2 d
    mov     dx, offset New_Int_Routine
9 [. R% I8 D  u) L$ ]    int     21h$ Q0 m5 U# r, F0 v& f$ ~+ Z
, M. W; d- o0 q: V3 M: X
__________________________________________________________________________
! A) m5 M2 j3 v& Y$ _0 u* L) {/ `( l" k' c! w
Method 09/ R8 r1 k/ [8 A; s+ A& m
=========9 v3 Z; B. p! n( n! V

: y' Q5 [8 c. k4 L2 qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  F4 d, V/ ?* f
performed in ring0 (VxD or a ring3 app using the VxdCall).
9 O3 O* ]8 y. W+ C( b1 EThe Get_DDB service is used to determine whether or not a VxD is installed
' N+ g; Z: ^$ u) ~" |for the specified device and returns a Device Description Block (in ecx) for) V0 a& t$ X6 z, k; W
that device if it is installed.6 ?2 M. Z* f: k5 m
$ J" q" ^) A* r2 t7 G2 ^5 m' f
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; i5 c( n9 ]' b5 X, E9 f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 E9 M2 C  k* g2 U  B- ^* `
   VMMCall Get_DDB% t( F$ r4 z! ?' R8 G+ R
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. m# ~6 n0 w0 }7 Z; f" O0 }( s2 e; g4 ]3 |
Note as well that you can easily detect this method with SoftICE:7 z9 U7 D5 U3 Q/ B
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 Y: G/ M4 Y' U7 I- i: M6 J  Z5 s0 A! ~3 Y- L& s* t+ }
__________________________________________________________________________/ M0 C2 {: N3 l

  M4 S  Z: j3 X& I) V2 K' W+ A5 HMethod 106 I4 Z: \+ M) ^, i' s  p1 C7 r
=========
6 G! F/ h& @9 ~. Z3 N( U* I7 Y5 I
: S6 H4 \+ }& z* C7 v=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) x) \. t; N0 ?  a
  SoftICE while the option is enable!!
3 ?& W  ?2 H$ O: d& x4 d5 c
: ], h# D/ t/ Z) ^2 ~This trick is very efficient:0 P  M( C4 n, \" |" i# o" I
by checking the Debug Registers, you can detect if SoftICE is loaded' J' E# R6 q& b" F
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if+ g6 G% b8 I+ F
there are some memory breakpoints set (dr0 to dr3) simply by reading their% b8 k7 H2 f3 }4 z! @  j
value (in ring0 only). Values can be manipulated and or changed as well3 b$ Y. N2 h5 ^& P( ^
(clearing BPMs for instance)
5 }3 V7 A; f; w' ~) H% R. o9 }9 w# P1 G- Z" N
__________________________________________________________________________
+ H/ W# M4 Q$ o1 m/ F8 ^) n) ]" t6 }4 m5 l1 D, S
Method 11
- N5 O% H3 b2 Q=========
( c6 f% ^/ w6 Q) D: M, t, t9 [; ~8 u. t/ F1 [7 B; ^3 F
This method is most known as 'MeltICE' because it has been freely distributed. p& [1 C$ R3 o  N9 C$ N8 |
via www.winfiles.com. However it was first used by NuMega people to allow7 {, ]& d3 Q4 E% `% J
Symbol Loader to check if SoftICE was active or not (the code is located
" f3 @0 N! G& G$ f3 ~inside nmtrans.dll).
! M( _1 k5 M# s" T+ ^% _+ `- W; ~4 ?2 s
The way it works is very simple:( r# x+ ~( s- m) {5 g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* g# }8 |  ]8 ?( T) G8 _& f, AWinNT) with the CreateFileA API.0 B- C/ P! }) m2 U

/ P7 m6 t: C; q$ xHere is a sample (checking for 'SICE'):
! }: t* u3 ]' Y  y0 E
+ x  s- U( p0 B3 QBOOL IsSoftIce95Loaded()
! w9 [7 Y; a4 q- o0 r, H{0 Z7 l( E: u9 E* V5 F9 P
   HANDLE hFile;  3 H. V! H9 s9 s: V, [
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. W8 ~* p* M) |: m6 X7 |
                      FILE_SHARE_READ | FILE_SHARE_WRITE,* _" m0 v! O  B: t3 q: a2 N5 |* l0 O. }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 U+ X" Z. X; ?0 X8 n$ m
   if( hFile != INVALID_HANDLE_VALUE )
8 f( d: O0 c3 J8 J3 m; K2 y9 Z   {3 n( F1 D* V1 f  x8 K& Y* Q
      CloseHandle(hFile);+ h  W& P+ [# L
      return TRUE;# |) M( |8 i5 _, M3 v
   }9 P; n- L  [% ?8 ~* M, j0 j" p
   return FALSE;
# y' R) K& [4 d3 ~$ @# A, A- V}9 K: v: @* d/ ?/ e
, z# u; j+ b9 i6 S6 a' }8 C
Although this trick calls the CreateFileA function, don't even expect to be& b/ C) D7 y3 M/ @
able to intercept it by installing a IFS hook: it will not work, no way!0 D5 }8 c9 m3 w
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 w/ D3 \* S6 a) cservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)* R4 V/ V  D* k
and then browse the DDB list until it find the VxD and its DDB_Control_Proc, G/ a  }, w. f* s
field.! l! g6 ^; {  m! ?
In fact, its purpose is not to load/unload VxDs but only to send a 8 H6 G+ S) T% y% ]' s4 ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( |; _# t5 E7 L* oto the VxD Control_Dispatch proc (how the hell a shareware soft could try
* X6 g1 U' |: q& F8 dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
! b" Y, P$ z  E6 ?& CIf the VxD is loaded, it will always clear eax and the Carry flag to allow* W! m8 ?; W4 h% N
its handle to be opened and then, will be detected.
; ]4 t- U9 Y$ [5 H3 C6 w) pYou can check that simply by hooking Winice.exe control proc entry point
5 A2 R* d1 V9 y/ J' Awhile running MeltICE.2 ?0 r( M' O% _
( E' B$ s5 H  E2 i8 n0 B
  K& l% n+ U5 s3 G+ P
  00401067:  push      00402025    ; \\.\SICE
2 H: `( n* Q9 H" A" w  0040106C:  call      CreateFileA
% q$ Q/ C9 Q9 L& s2 Q0 ~  00401071:  cmp       eax,-001
; d4 D$ k6 m9 T0 \# E* a  00401074:  je        00401091
9 b9 Q1 l6 Y+ S
# D" l/ S( j) j# p7 \6 g' F' {( w9 l6 p
There could be hundreds of BPX you could use to detect this trick.
" r1 V& \' P" l. |-The most classical one is:. v2 X& l7 G1 v- C* N* s9 C
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' m7 z+ I6 |% b8 E. U
    *(esp-&gt;4+4)=='NTIC'8 W1 p. a1 }2 L8 T7 ]( K! U/ C( \

( _5 m' T, e; K7 I* N-The most exotic ones (could be very slooooow :-(
% J% l- D" Z1 v1 u* _   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
- p" ~) q1 v& r  |     ;will break 3 times :-(
' a4 v; [- L: y3 c( t- u
* h! z9 O/ j0 W4 K3 u& m-or (a bit) faster: 9 a! e+ p# n# ], @/ R  c
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')- T; H- y! I0 H1 t4 g6 V$ Z
, d! A. G: X/ I6 f
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  2 c" w2 J: v! ~; _' q6 Y! j" v
     ;will break 3 times :-(
# x8 i$ ]( D) W! p: _* Z2 M) a4 ~- K0 j: m1 n' {3 {
-Much faster:
! s. F: q4 j2 [! _8 [/ n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 X2 a# K7 S5 W& T; r
7 j5 C& d4 y! P% ?- w% W* O
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
+ |% z6 n( c2 e& N1 L* N7 Q- Z2 @9 cfunction to do the same job:
2 t' c7 H* W1 O+ @/ V; G" p( K5 a' i6 C0 C* X  S
   push    00                        ; OF_READ
% s# F' f- x* {7 o+ N3 c7 e% ~   mov     eax,[00656634]            ; '\\.\SICE',0
% f; o) i. p. v   push    eax+ G$ ]- W$ ?0 Z" y8 [
   call    KERNEL32!_lopen
' L* [0 N" c* L7 y# n/ L   inc     eax
* {( r; z& w3 S( Y8 @3 ]   jnz     00650589                  ; detected* I* P( C0 G/ J& l/ U. w2 @, F3 `
   push    00                        ; OF_READ( i. H- \; L2 d2 b+ n7 w9 f! ~+ X
   mov     eax,[00656638]            ; '\\.\SICE'
( H) F6 I9 o9 g2 N   push    eax* I5 ]/ P8 I4 A
   call    KERNEL32!_lopen
7 n! a( ]/ q. a1 l" V- N  y# V   inc     eax% D" W( ?+ ~" n3 c# ?7 }+ ^
   jz      006505ae                  ; not detected# v: c" v) N0 o! B6 x
0 F; \9 J+ V& j$ \! ^6 \0 g
! [5 y+ l! p+ D3 i& G
__________________________________________________________________________
( Z0 V% K6 _% [% k2 [7 b1 y# m  T/ A
Method 12- S2 L- Y- d' E) I5 ^  }9 \
=========
3 j1 [. D& E+ X. \! J  O6 L; S+ d9 A) v& [5 J2 e- z
This trick is similar to int41h/4fh Debugger installation check (code 051 h0 k9 b! s/ D+ M3 a
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% T. F1 @" e/ {3 `) L
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& ^( T* q+ e  j( B# e# P3 \
8 k: Z1 i& M; g1 y. i   push  0000004fh         ; function 4fh9 w. h, [4 }( y! z
   push  002a002ah         ; high word specifies which VxD (VWIN32)* e" ~* ]* V: _) V3 d$ {- c# Y& x) _
                           ; low word specifies which service
" ^9 x5 L; _/ W; F- I0 p3 L                             (VWIN32_Int41Dispatch): \  m, e& U/ o. L8 t; V( H- W- m  m
   call  Kernel32!ORD_001  ; VxdCall1 H+ T( j6 j1 w# V$ c
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 T0 g. }9 Z9 L' i4 a. `   jz    SoftICE_detected3 c/ @7 ], v7 S

3 V( @) s- V! n  O& k" dHere again, several ways to detect it:
+ \& P- j8 L% K' {/ m8 j4 o& q
2 p5 @# S6 f8 I# I    BPINT 41 if ax==4f8 _& _: y% {9 v' k" h3 N3 G

2 l! F/ \* [# @, A+ K    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 v$ j9 Q( v8 J7 T4 C. G' R( q
" e- b- Z5 `* g1 M    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 ?, d9 j" x; k; G2 g
& p* z' g* A. a1 V, l/ ^% ^& Z3 d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) e1 z# x  ^: v! A9 W
  C+ g! `% v" X' R: [. G7 B
__________________________________________________________________________
& m1 o3 B. s* v+ E2 i" p
0 p# p" F6 @  d0 F  @; m7 CMethod 13, @  Y' B" \' t1 o1 W
=========
3 T2 i2 \$ w( V0 p) C
  h1 e! j$ v8 o" d0 {& QNot a real method of detection, but a good way to know if SoftICE is
% ?2 A" K7 U1 v" M! @8 B; Binstalled on a computer and to locate its installation directory.4 G1 N. M  I5 N
It is used by few softs which access the following registry keys (usually #2) :! D& _4 L3 j& T) [
* i! S8 y# b- X/ j7 M. ]  U
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( R/ m. E& j6 y/ f, `
\Uninstall\SoftICE$ v! p, M7 [6 A$ L. d4 H) e" t4 |0 {
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 g, @- \  @! V9 N$ d" c" I7 B
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& l* b! t! Y8 a9 C$ L5 E\App Paths\Loader32.Exe
7 ~. D* {* X1 `# e! U1 n. E# j, Q+ J+ S3 {. B4 u8 `# P
. g7 {# i4 l+ C2 \& C
Note that some nasty apps could then erase all files from SoftICE directory' ]) o. {, `( `) j
(I faced that once :-(. ~0 {7 v! P5 [1 h$ v% g8 z

& |# E) Y# v" [6 v& A/ @# AUseful breakpoint to detect it:
& O% G. d) P  R) B* \7 [3 k9 @, ]1 l1 T% j' I
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
- ?; B7 E  w: b/ v* v
9 e  A% K8 ]6 {: e2 ?__________________________________________________________________________% W2 _- S  |) p  C& R9 C0 C
3 T( n6 f0 r/ V+ S$ o9 P" H

8 J& h: k% N% G. l. eMethod 14 , n1 p, }! ^, ?! \
=========
1 y, L; V( e# K
4 O$ B  q; p% U7 E; W+ F2 wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
. n$ P) z+ F7 c5 h3 his to determines whether a debugger is running on your system (ring0 only).
* Z- D( L# N8 Z% d9 ]: P
  O. G& H) a# r1 z   VMMCall Test_Debug_Installed
# O! n) H- W$ S   je      not_installed, V( r/ O. L" G* K- I% _- A' X" }
% R6 z1 n0 U7 {' e  W: C" ~
This service just checks a flag." O7 M) x  I% V# n
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部