About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 K, S; H) q+ w2 Z/ X
<TBODY>7 S  F8 k  H8 Z. U
<TR>
( H0 h% f" A, Y. U( l: h  d<TD><PRE>Method 01
) e1 |1 H# r) @( }4 p# w=========
: \. l7 C' Q6 E* c+ p- o- Y* N
' O4 p9 x  d8 l4 `6 l' rThis method of detection of SoftICE (as well as the following one) is. m% k6 `" ^; E4 z& G9 b$ R
used by the majority of packers/encryptors found on Internet.1 F7 X% F5 B% \) m( F5 ?
It seeks the signature of BoundsChecker in SoftICE
( S. r. E6 o6 o( @, A# B) A7 }* n4 }) ]$ Q9 |* r
    mov     ebp, 04243484Bh        ; 'BCHK'
% o4 T6 Z" X! X7 I4 |* s    mov     ax, 04h
: r) w2 v, S2 P' Y    int     3       1 N) u; _0 g( n1 ^
    cmp     al,4
# {0 Z: S, g$ `: _    jnz     SoftICE_Detected
. n5 F: k  u% B1 _& Y9 e
( Y8 `% B$ o9 j  m! {1 Q1 h___________________________________________________________________________
; N2 B( [3 O& |) l1 t: [' E  Z9 B% h+ k: \7 `9 t. v% `- V) N
Method 02
# w; X" u- f$ N! H, Q9 n=========
4 t- ], y: ^1 t% ?" o2 o( R9 z# K6 I: x4 H. D6 Y7 A! n
Still a method very much used (perhaps the most frequent one).  It is used
  l0 Z( d& O/ X2 y3 [  nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ [% H6 l" g: _/ ?
or execute SoftICE commands...; Q; q0 U$ S/ v* f% Q3 a
It is also used to crash SoftICE and to force it to execute any commands
7 e1 m& E/ `! v9 S+ L(HBOOT...) :-((  
0 \# d& G3 S4 j4 i5 T2 o, i" b' a& G4 F
Here is a quick description:
2 I4 q: Z7 b: j3 p7 D6 s2 p-AX = 0910h   (Display string in SIce windows)% f: H4 y, ^5 F& Y- l' Q6 ^' E, f
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( P  l, q  [6 V
-AX = 0912h   (Get breakpoint infos)2 ]* F% A- \4 A4 ?: C6 @' W
-AX = 0913h   (Set Sice breakpoints), n1 ~; Q$ U( }
-AX = 0914h   (Remove SIce breakoints)
7 e" I7 N( l2 S& S( J# V) F6 C& s' p$ E2 [1 R2 g) G
Each time you'll meet this trick, you'll see:3 ?. ~" f+ i8 T: r1 H
-SI = 4647h1 O0 [' w$ |! t  }& A
-DI = 4A4Dh$ p( u; q; B3 X
Which are the 'magic values' used by SoftIce.
4 I: n# I! u# n* M1 _For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
4 o1 d9 H2 j& [4 H2 t% n% H; F$ N2 P, ?6 Q( B
Here is one example from the file "Haspinst.exe" which is the dongle HASP3 L5 V4 |) i, k% v  n" T( C- N
Envelope utility use to protect DOS applications:
; L8 j& s/ A) P) o( @( y, }
" V$ v7 {0 h& Y5 u! D+ F2 n
% E2 e4 z9 Y* }3 T# ~6 z; x4C19:0095   MOV    AX,0911  ; execute command., s( o; i7 @9 q7 |1 x: I
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).7 G5 D5 w6 a: S! P+ d: M1 `/ z. H
4C19:009A   MOV    SI,4647  ; 1st magic value.
4 i1 C2 K9 B. ^- j& h, b4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 k. m) w$ m- i7 t% S1 Q  D
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" {2 d3 @( ?4 l4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! p8 }) l! \3 z. I! f- E4 Y4C19:00A4   INC    CX
. ?$ T, i& z* ?, S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 x4 f0 L' G  G& a7 j4C19:00A8   JB     0095     ; 6 different commands.
6 y+ a( n3 ~$ j3 Q+ P4C19:00AA   JMP    0002     ; Bad_Guy jmp back." A! W4 a/ A/ z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 r' U$ V: t7 f2 O: c2 ~

; J9 p: V- p) f) u; [8 a( G% ZThe program will execute 6 different SIce commands located at ds:dx, which
2 G* x& N; [1 i% u3 {are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
% r6 @5 l! _+ ?' V, a8 n3 B+ k9 `4 l, g% r) F) L+ ]0 C. o
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* `8 y$ u# y7 \. Z3 i1 Y___________________________________________________________________________: e- z# u  b8 @6 [2 i

2 e; k# p) S/ m; o3 e% O' x( m: @, D; S. k& z. b" U. t
Method 03+ Q; ]7 {3 l- j9 G0 E
=========
5 j: V' H7 {( {3 ~& h( ^5 e* K0 v$ i4 b; y6 \5 H
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  J# L. e* M% }0 M2 |& ~& s(API Get entry point)1 W$ u' Z) d) G; k, p
        
. p/ D* e1 I; D+ U: W
8 w, }; ^: D0 H. ?7 i3 b    xor     di,di
. X1 Y2 b' s7 k7 A( ]  \& f4 X    mov     es,di/ Z  J3 P2 X+ e, `/ U# N7 {
    mov     ax, 1684h      
. E& S+ H& t) a; o5 S+ }2 p    mov     bx, 0202h       ; VxD ID of winice! f4 A9 Y  @/ N; J9 n
    int     2Fh. @" O+ l3 i4 E8 g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 W9 X7 ^4 L" L4 i" Y2 F    add     ax, di3 @3 b4 I7 H( S. ~1 b
    test    ax,ax
) J( D" M- j" ~. o6 M    jnz     SoftICE_Detected* J/ h) c# G1 s  T& q( d! r0 h

2 R" f$ K! D& c' _( n___________________________________________________________________________
7 q7 c' E7 g$ `. Z7 K3 @  t+ m2 G
Method 04
5 L7 `( E* O0 a2 V! d0 T0 i0 j=========
8 l) k4 ^9 i; M8 |) V
' s, {- u2 ^( r# l$ Q  k5 k2 VMethod identical to the preceding one except that it seeks the ID of SoftICE# I3 \2 U3 O, h* |0 }2 O
GFX VxD.
9 O  J7 n1 Q: A; S- e1 Z5 p4 Y; Y6 N* |
    xor     di,di
2 I" k9 g+ v$ @# D$ ~8 l5 F3 g, p    mov     es,di
) k* D: Q3 B; p    mov     ax, 1684h       , d3 D" }1 [3 Z, s
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 l; }" e/ Q9 q
    int     2fh8 {" l: ?" D3 P( z9 e2 o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: T" k$ Z, H- e3 P
    add     ax, di$ @( h1 v! e1 q7 E* H
    test    ax,ax# ^  K* f+ s0 }( E" ?
    jnz     SoftICE_Detected1 ^4 J- l' x7 l( A: t+ S2 K
; h- C$ h- F" Z' c8 P0 b6 D
__________________________________________________________________________' C$ d9 C" L$ k. e. F
0 g: u8 W' ~3 ^% _& R
* _  U1 S4 p  a5 {
Method 057 a1 M( r' |5 V* S
=========
( v/ y5 O; R  B: ]
. A: y7 z# [. MMethod seeking the 'magic number' 0F386h returned (in ax) by all system! `1 S# f1 B! p+ ]! C
debugger. It calls the int 41h, function 4Fh.
! L% h- X/ ^$ u5 {  o1 V; EThere are several alternatives.  * }' n4 T* ]+ {. e8 a
# ]4 [) ~7 t7 y' n7 c) N+ {
The following one is the simplest:' l) E9 A4 i4 ?. Z$ b2 z. I4 Y
, H# G& f6 _6 l' l9 w
    mov     ax,4fh5 W% n8 J- u# g2 N4 G; o
    int     41h
* ]8 K. H- Z. r- ?$ l1 c- B    cmp     ax, 0F386- T5 H: P  d/ R) O8 i& q1 [2 Z
    jz      SoftICE_detected* v8 G: B  b- w* K4 ~
  r$ q3 g) n( |! Y! F. Q

" _# Q' l& E) lNext method as well as the following one are 2 examples from Stone's
: \3 _: E6 X. g5 y/ F, n# t"stn-wid.zip" (www.cracking.net):
9 n5 e% @8 [. n1 Z2 s! [6 i, r0 c$ b; i: Z) a  S' t
    mov     bx, cs' |' x0 u" w  a% }$ R3 p7 Z* t
    lea     dx, int41handler2
( s5 G" q0 e, e5 A# `, F    xchg    dx, es:[41h*4]
" I1 w1 m0 P( |4 {3 A; c( Y    xchg    bx, es:[41h*4+2]! z( |  i/ m# F& E
    mov     ax,4fh* Z& G, [4 D& O5 i5 n+ N/ u
    int     41h$ v- Z0 l/ O- V4 t! r
    xchg    dx, es:[41h*4]
% n& R- A$ V7 @% p; B: [    xchg    bx, es:[41h*4+2]
" e  x. P& ]  i" _0 C: e! p5 R( g    cmp     ax, 0f386h
5 J" x; y9 Y) Z5 O$ |2 A2 j    jz      SoftICE_detected
% G/ ]' _% \, O  a
; u8 |- \" Y! K+ N. Uint41handler2 PROC& W# K/ t- T: x; w
    iret/ ^+ p+ \0 F  Z" z) x
int41handler2 ENDP( X- s5 u' S! e& u1 ?$ R) B% L$ _. M

; c6 f; @, v2 L' D# U- e2 N
! q$ B5 Q7 X8 W3 e+ h1 A_________________________________________________________________________
5 k: e4 `+ D, v( V$ m4 L/ q' O1 M/ a9 q, l" j
1 y* K9 @; m/ t+ a
Method 06- E& `+ Y1 p2 l9 q" I0 ~7 ~6 s
=========2 t! g- S% T1 b6 }6 B  h
# b- _. b& [* z3 K9 k( x7 E

, }5 c0 X. s, G+ o/ O, l: O  V2nd method similar to the preceding one but more difficult to detect:! |3 z! G6 ]$ r( V" e$ s5 P  t1 t

9 h/ ?7 F( \6 {, g( T7 `5 l4 J" C: a$ `$ R
int41handler PROC
/ E" c. Y4 _/ Y    mov     cl,al
6 o, K( R9 S& [" ]& Y    iret) m" U3 }# O4 i+ W  y4 m; l
int41handler ENDP
; E6 L9 W" _8 W  l6 i: x, M
% X, }% [# [6 I0 J3 ?
) m" ~3 L1 j8 b6 q    xor     ax,ax
: \# ^8 b$ J! `3 p9 o5 }/ ]5 j    mov     es,ax% |, {- `0 Y* Q/ }$ v0 H: P/ N- F
    mov     bx, cs1 M& x$ s7 \5 v* C
    lea     dx, int41handler& E- [3 M, W3 V3 y8 P
    xchg    dx, es:[41h*4]5 k1 i1 J# i  ~- c
    xchg    bx, es:[41h*4+2]3 ~  S1 j: {* O
    in      al, 40h
/ n# Q. M: R; C2 P4 Y8 H    xor     cx,cx( l( W- {$ v5 u- w- j" C2 R* }
    int     41h
1 E" ?" V  j. A% p6 i/ K: `5 C    xchg    dx, es:[41h*4]7 a: D. t/ B( O
    xchg    bx, es:[41h*4+2]
" s& \2 R7 }) H" R- r/ ?    cmp     cl,al
  p: M% J9 z8 R7 D    jnz     SoftICE_detected! v" u, V/ G$ Y9 V' G2 z- @
. c  u* g+ B% E2 u
_________________________________________________________________________
" K4 u7 E# F( l- V
* h  s0 j5 A# y6 `, Q. yMethod 07/ s+ G5 V0 a7 d! \) b
=========& l- Z3 v( b4 d

# R2 ~. d  r& ^  d- [- cMethod of detection of the WinICE handler in the int68h (V86)2 ]7 t9 {! u! ]$ Z9 \, Y$ K

5 r6 w$ |. D6 S    mov     ah,43h8 ^1 K9 ^# M, B- W+ n
    int     68h
! r7 N  n3 L+ `7 L" C5 c# |: s    cmp     ax,0F386h4 Q: A* T, M. ~  ?! P# _/ ]3 ^
    jz      SoftICE_Detected
; c5 m& n5 c3 \: |' [/ B! h& g  v# i9 g, k$ d! f/ u

. Y( C8 K0 E# E/ [=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" M. i8 z2 T2 P   app like this:: @# S3 L! K( p; A: b% m$ p2 ~7 U7 A
$ f5 j0 [6 o( }" S# S; d2 F8 W0 I
   BPX exec_int if ax==68. S# N( ^3 e. a. W$ u# @' K8 f- L/ V
   (function called is located at byte ptr [ebp+1Dh] and client eip is  D8 S9 E4 v3 }# f4 m
   located at [ebp+48h] for 32Bit apps)1 a: T2 e$ ]) m8 r4 O% M
__________________________________________________________________________7 ?0 Q9 B0 i6 p0 v- g9 h) T  ^

( n& H3 a- T- i( x( }$ z2 j0 X0 N" {, d
Method 088 t6 W" x( h: Y: Q' C
=========
! E! X8 b1 w/ ]& O2 Q
. b$ L! V9 e% KIt is not a method of detection of SoftICE but a possibility to crash the: `- w& W& `0 P* N
system by intercepting int 01h and int 03h and redirecting them to another
4 W# u* o' S& H7 ]' |routine.
* y- ?( ]2 t/ [( J( JIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# n% a$ j1 H+ r% g
to the new routine to execute (hangs computer...)
0 T+ k3 S* l2 k9 ?0 o0 r9 R% _' J: V5 ^) Y+ l: ?
    mov     ah, 25h' t! g* g7 x" @4 ]5 }0 n' x
    mov     al, Int_Number (01h or 03h)- j0 Z5 L: a/ T2 ^7 U" e
    mov     dx, offset New_Int_Routine
% Y" ?8 U% m. _9 S" A    int     21h
0 ~) C1 x, S. g3 U
9 X, t& ]7 j! `5 e__________________________________________________________________________
" z, u  v+ p& w' T. M& J% o
! h, d8 p- p5 i- YMethod 09
$ K- S. ~) J/ ^6 T=========
% I" |6 f! T. d% |* f3 S0 G. _8 M
+ j2 ], {, W3 n! m* vThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 f  Q- _9 y0 z
performed in ring0 (VxD or a ring3 app using the VxdCall).* @; e( D" b7 k6 Q
The Get_DDB service is used to determine whether or not a VxD is installed; I9 t& f" c7 W! {. F* D# h0 h
for the specified device and returns a Device Description Block (in ecx) for8 `3 u) }# Z" y
that device if it is installed.
6 Y6 ]4 S! C$ z; b8 S6 U6 ?1 P3 d5 p* U2 q2 O- Z" W  `; D7 y
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# _6 x6 Q; o. c# ^) O- l1 A- u
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ m, B; a1 L$ p5 w( ?3 Y
   VMMCall Get_DDB- v: R, h! ^5 Y( v) B
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed, F2 |3 a% g2 }- s; e3 }
( s! P% m: R* Z4 |
Note as well that you can easily detect this method with SoftICE:
  |5 ~( w( j3 C0 h$ A   bpx Get_DDB if ax==0202 || ax==7a5fh
4 F. Z) y* _; U+ ?
' V# |, y* Q1 ?! k- x4 V( F__________________________________________________________________________
' _! [4 n+ V( c  F, B: d3 a1 o/ O8 f) W; s( Z3 P0 ?5 t; s7 L( |
Method 10
7 f  K+ ^5 h8 o' b5 h" \( m9 Q=========4 y* h! u, w# T! W* e5 y+ f

) Y7 e( z8 K% i5 J2 z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with& g8 i# e. s  }( ]) P
  SoftICE while the option is enable!!
0 [! [" l) |7 O9 Z% C  R. T0 E  {1 ^3 Q* k  q7 M% z! `& l
This trick is very efficient:- o. ?. w; l# U; [( E! R
by checking the Debug Registers, you can detect if SoftICE is loaded
) s6 z5 B7 v7 |9 T  e( w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' {7 S! x( v- |! v: _
there are some memory breakpoints set (dr0 to dr3) simply by reading their
, m) o1 U0 @' u: y# M  w5 ]value (in ring0 only). Values can be manipulated and or changed as well
- I' R: f8 w9 m1 X4 A  Y" z1 n(clearing BPMs for instance)/ [8 o# m7 X$ l" T+ B; M7 _
) Q* T- Z) p) M, A- `0 m
__________________________________________________________________________  `( O7 z" s- ^: p' l$ Z  G
& |2 n2 c+ I; K) s, }1 X3 d6 _6 H1 `
Method 114 m' f9 `1 g' E
=========- a2 S/ R& V( R6 ~6 f% H: M, a

7 ]  X9 v8 J+ P& P/ N( DThis method is most known as 'MeltICE' because it has been freely distributed
+ f: _# S. @5 O; e( a2 ?, e) jvia www.winfiles.com. However it was first used by NuMega people to allow
6 L% A! O: k6 m3 n% [Symbol Loader to check if SoftICE was active or not (the code is located
) m8 y3 u: w6 T; ainside nmtrans.dll).2 b5 V# r: [4 n8 s# f8 ^

0 U' L8 `/ w9 S$ AThe way it works is very simple:. ]2 p' h- v" q6 I7 y8 [  x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 \# i, z+ H" a5 V' U5 @) eWinNT) with the CreateFileA API., u# K) [' U) K4 \+ G" {; S

9 B- K$ g4 ?# h. ?, Q; o- aHere is a sample (checking for 'SICE'):( O8 T/ U+ `" |5 X$ _/ Z1 d9 Y% U
9 P7 ^; I' \6 m4 {- X, k: z* x
BOOL IsSoftIce95Loaded()
! w& L: S: _$ Y0 |* V{3 b% w, w6 v/ a4 A$ s8 L- r5 W
   HANDLE hFile;  
2 O  a3 x! @* L' u: B5 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% r! r# m, M" Z) Z1 w0 {7 @                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* _4 v9 T! |7 }- u/ `& J                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 [0 `  a9 Z! w9 ~$ d) Q# E# d
   if( hFile != INVALID_HANDLE_VALUE ); i9 n, [9 J6 }3 |) e
   {$ p8 M& \+ O  \& I  A
      CloseHandle(hFile);
  H3 h  ~  {" M) v: K0 W      return TRUE;
8 b5 M  ~7 K' ]+ \  K   }% K0 k9 v' n! I3 M. ~4 c
   return FALSE;
: K2 w) d% A& v2 i; l( v* K6 {}
" Z6 L) j' `# S5 o6 q9 w$ x' d7 k& ?, g! Q, a7 a; ?! _8 ~
Although this trick calls the CreateFileA function, don't even expect to be
6 {+ j# J) J, F; Mable to intercept it by installing a IFS hook: it will not work, no way!: }3 H3 ?3 s% c' R8 r
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 i+ ?6 t" H3 `" n' g! |# o# sservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
6 e5 {8 A, ]  n; I) {1 `and then browse the DDB list until it find the VxD and its DDB_Control_Proc1 |7 `7 A$ C5 Z" n  Z
field.
' ~# y% {- I8 c; C9 U) o8 m  bIn fact, its purpose is not to load/unload VxDs but only to send a & ^; ^. }+ q  w" M# M3 e
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 ?( u8 G& V" R) H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" H: C  S7 d! M, vto load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 V) J- i6 f! V9 f$ N1 i% I  IIf the VxD is loaded, it will always clear eax and the Carry flag to allow
' f9 m" m7 y7 N1 `& B. vits handle to be opened and then, will be detected.8 x( N& F* Y, a# W
You can check that simply by hooking Winice.exe control proc entry point
* i2 E" v, X) S- i  }while running MeltICE.8 E$ |9 l" _4 r$ j! |+ A! c
% |: I  s! a* J: q+ @( ~
$ S% ^/ v' M# u5 M$ m  N1 d
  00401067:  push      00402025    ; \\.\SICE8 ?* j+ O* D: p5 B  ?
  0040106C:  call      CreateFileA9 S- m) @( b+ T, s
  00401071:  cmp       eax,-001+ a5 g* k" `* L6 a  |6 D1 F
  00401074:  je        00401091
1 e  Z- a/ S$ W% ?$ p1 u. D  _4 Y) v  R# k
/ E6 C, ^6 ^) r' r2 t% g
There could be hundreds of BPX you could use to detect this trick.
' P+ U$ g6 |8 O: t: A0 N9 l8 M' t-The most classical one is:
' J2 E, s' f( n- Y4 |0 `  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
3 Q* j' o" I/ y7 L  [. H2 g    *(esp-&gt;4+4)=='NTIC'
8 Z! \* K% P$ E" n2 X7 V3 O: V6 i% b$ a" P7 _9 p; F* `
-The most exotic ones (could be very slooooow :-(
/ A- T4 Q  k3 y6 X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 B* N/ u5 W. g
     ;will break 3 times :-(# ?8 [. C' J: [2 w9 n( Z
5 J: C; ]% O" f$ v" Q
-or (a bit) faster:
8 _: C  [/ W2 m. Q4 L  V. i# l   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
0 O% U% |! Z+ R, K: P2 ?* s$ E8 m) }, v& r, x( r; _, ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 W+ I4 Q1 s* T$ {     ;will break 3 times :-(2 e" N7 V2 }0 w( N' t1 ~: n. z( @- r

& M7 W8 B- G( H+ l5 ^, H-Much faster:
$ R$ Z7 U' e8 E; z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
( n7 Q) v  g2 e/ K
6 ~% w6 G# P2 d3 R% ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# m( w4 Y- D/ u$ j) Wfunction to do the same job:+ O# Q% g8 x( [8 v) v/ y
$ T% [6 }+ ^0 h' J/ E- }+ x( V9 x
   push    00                        ; OF_READ: X4 [6 {2 I- b2 k! A
   mov     eax,[00656634]            ; '\\.\SICE',0
. U$ I' }, l2 S. r6 B" y* C& ~   push    eax
8 u' B. k  I/ ?' Z5 N6 D   call    KERNEL32!_lopen& [, |- {5 k  |, F
   inc     eax& r5 d! I8 l# ~9 ~) s( j/ {: ?
   jnz     00650589                  ; detected
$ g, n/ M# s( O3 B  Q   push    00                        ; OF_READ
& c: w" ], B" B0 a1 E   mov     eax,[00656638]            ; '\\.\SICE', l! k( G9 f" V- M
   push    eax( _: @* }, K9 Z9 \1 l! t
   call    KERNEL32!_lopen
& V6 N% J* U- ]9 {0 w   inc     eax+ b; ^0 Z( ~8 n4 [+ h: a
   jz      006505ae                  ; not detected
0 C0 O2 v% H9 J! c- ~( I' g3 @% \9 U4 p9 o

) r+ f' ^4 Y: L/ a4 x" m__________________________________________________________________________
6 R' }! r; Z; G/ K/ `% |8 {" o& l- i; ?/ t0 ?$ w/ i
Method 12
1 x4 j) Y; Q" e=========% g+ n0 Y0 X6 H4 m% i$ g: H

0 B, x) f5 Z  T  ?3 _$ r5 qThis trick is similar to int41h/4fh Debugger installation check (code 05$ O* \! |; P$ l0 ~" Y
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
$ o7 V4 t# A9 J/ i% Gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( I3 A/ B+ N6 w3 ]' a% Q+ n% q+ P2 |' n0 s; {/ i
   push  0000004fh         ; function 4fh
9 m& h1 d/ J8 K   push  002a002ah         ; high word specifies which VxD (VWIN32)
; ]! a9 t* r) v1 {5 O                           ; low word specifies which service% w# ~. y. g% m9 w/ `
                             (VWIN32_Int41Dispatch); j  T% u" w6 d2 G
   call  Kernel32!ORD_001  ; VxdCall, P5 r' W/ s: Y' a: E$ N6 H
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ k# j, @; M; R   jz    SoftICE_detected3 p* C, c8 X5 Z: N+ Q

3 [1 `7 t3 \# p) ]4 d# JHere again, several ways to detect it:3 R, w& H3 P8 T7 O0 J/ A

2 W; C2 k9 O2 z) m5 t8 T    BPINT 41 if ax==4f( a5 ~2 ?+ ]" ]' k! j4 d8 X

" |$ v9 @/ I9 q; g5 t6 S4 y( E  G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; Q3 n- q/ f+ D! W
+ z$ Q* [9 }* ^" a( v$ \3 r    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A2 B) @" c, \9 |( h; O
+ A0 k& Z; E( \6 M& ]# O
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' L8 `6 r! U) [5 E+ }; x" R
3 T* f. U  R- y& ]9 ^# y. R* u
__________________________________________________________________________+ z  W2 V+ F1 h) I
1 M7 N# _8 K8 C, B* Y' M9 r0 N6 ~
Method 131 N. ^5 M9 F; h5 l: k: Q
=========
5 w0 E; P/ Z2 ^, F8 r- B
# {+ d8 E. n! l4 I" N9 uNot a real method of detection, but a good way to know if SoftICE is; f2 H  o# G- K& j
installed on a computer and to locate its installation directory.
6 H9 F: }6 R* W1 OIt is used by few softs which access the following registry keys (usually #2) :
. D' ?0 [9 ~, o! p
& O% f- m0 O& [7 R& B$ E( q5 T4 z/ {5 O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 U, J3 N- ~$ {6 C' |
\Uninstall\SoftICE
% R4 y; F. f. F4 \2 w0 w-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 R. R, E- g9 {, `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 d. M/ g( n1 n. h\App Paths\Loader32.Exe
  d1 n- J0 b# R  e# c( Z& _. ^7 {, W* B4 |
; _. W8 v6 h/ N5 ?9 R
Note that some nasty apps could then erase all files from SoftICE directory0 c' O6 J" @7 f* n; X4 j7 ^4 O
(I faced that once :-(! _; z, I1 a/ D) B; y5 ?
/ j' w- p9 ?8 s& A* d2 v
Useful breakpoint to detect it:% f4 X; H% r; P

' {+ |$ x2 M: `1 z5 _) R$ x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': D' m, h& E9 D7 j& x

6 Y3 q  z9 z1 W- q__________________________________________________________________________/ R  h  E/ `" X1 A5 z6 r
3 m  `' \8 n- z  P

- O9 u7 z1 Z' u  CMethod 14 " l" d% m: `; N& o$ C* a
=========' R; n. S) ]1 v/ G
8 d$ b1 \' e( F# M& W( H& |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" H( B$ H- n) k9 S& o4 m
is to determines whether a debugger is running on your system (ring0 only).' @0 h5 Z: r1 G" a
+ g, O- o8 x$ h) k: e6 o" R
   VMMCall Test_Debug_Installed. s  V6 x+ P& b+ v+ g
   je      not_installed
* p) p0 F6 y3 [6 C# c2 M' W1 z9 J* f/ K' k9 k5 W) w7 l  e
This service just checks a flag.! l( F# J1 ~; Y6 ]' Q" j
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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