About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
5 Y5 Y" J( f  c! ?) w<TBODY>" w- {) d5 D0 ^) I
<TR>; p6 l& i# c  W9 v
<TD><PRE>Method 01
2 D* e9 v$ w2 ?# M. R=========
1 n9 t6 D% C% t1 o6 c( {
9 T" f$ X  o9 P/ NThis method of detection of SoftICE (as well as the following one) is
  X3 y% T8 A. v  X( E: mused by the majority of packers/encryptors found on Internet.8 ]8 u+ K5 N1 C% }  J4 s2 K3 Z. c! X9 i
It seeks the signature of BoundsChecker in SoftICE% v; _6 t0 `- G7 Q* M, w4 M
& p5 U* b( Q2 k" @
    mov     ebp, 04243484Bh        ; 'BCHK'( C* w* Y2 Z9 N! |
    mov     ax, 04h  e+ t* u+ G! n2 B1 F  ?
    int     3      
3 t5 `" h* R! o- j* r' t' j9 C    cmp     al,4
# W: P+ g- O, b- L    jnz     SoftICE_Detected6 [! ~% F, Q7 ~- T# l) {6 D

' ?1 D; m7 w8 R. w___________________________________________________________________________2 O* a2 a4 S) ]! T4 _' W
% a! \- m& H* q) A' I" J
Method 02
3 J' ~4 ?8 r5 \9 r/ z=========
+ Z% K4 l% z- m% P, E+ E- _+ `( y+ d8 g) \: W* I8 Q) C; a
Still a method very much used (perhaps the most frequent one).  It is used
+ d3 U3 x% h/ i$ Vto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ q+ E, V& a4 _# S0 ^7 T
or execute SoftICE commands...$ x# @8 c6 h2 j2 S% _, B
It is also used to crash SoftICE and to force it to execute any commands
0 D9 ]$ i- @7 J/ E(HBOOT...) :-((  
1 ~. e2 S; @4 [" E0 q; ?% L5 Z7 I4 W; ?2 _
Here is a quick description:9 u$ ^# \$ d$ ~7 t, K
-AX = 0910h   (Display string in SIce windows)
8 `0 D5 Y* h8 U5 ^" Z. S8 k" `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  q+ D* a) y8 S( @$ s-AX = 0912h   (Get breakpoint infos)) L5 r( k  @& x3 t0 Q2 N8 Z4 A
-AX = 0913h   (Set Sice breakpoints)% d( p+ a+ R6 O; @
-AX = 0914h   (Remove SIce breakoints)' ]% r% @- s% }& u  z; e0 T

  x' J: V+ ^7 d6 V2 w7 ^/ BEach time you'll meet this trick, you'll see:
- R9 U# i$ z: K; T6 j  C-SI = 4647h
6 o. g) x2 |' n  h  [$ V-DI = 4A4Dh
$ \) g8 f  O2 E# x% gWhich are the 'magic values' used by SoftIce.
1 [7 M! n  P4 x& W3 I4 E+ }For more informations, see "Ralf Brown Interrupt list" chapter int 03h.! t: e* K; ?& \& \

2 X; [0 N  H  Z6 [9 Z! g: AHere is one example from the file "Haspinst.exe" which is the dongle HASP
/ M9 \7 b8 r" W9 x1 M& M3 yEnvelope utility use to protect DOS applications:" R/ F8 |9 ]; c" }3 R  @

- u4 U9 H# u( R' v3 ?# {
$ ^+ E$ |, D3 I0 ~2 p6 {2 f! p4C19:0095   MOV    AX,0911  ; execute command.- F* H; J1 t! t* o: o) \: Y9 C
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 H* v3 l! y- o* m+ X
4C19:009A   MOV    SI,4647  ; 1st magic value.$ D8 n) U6 g5 x/ {+ m& d3 d
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) L: F* O" }2 _% w/ L! E9 _7 W3 T
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( f' w9 M& P% j3 D
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* J: I. U6 {1 b; W  M3 K4C19:00A4   INC    CX
  r2 P& W  v+ l' t7 O' N" T# G4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 N  U0 v9 |& I) ~: Z8 P4C19:00A8   JB     0095     ; 6 different commands.
0 y/ ?; d- l2 [& K2 E+ ^: N2 l4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- K( p' T0 }% Z2 t4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 |9 h5 i4 v7 S! w2 j5 b

0 x) Z8 |/ d5 j# {& `/ cThe program will execute 6 different SIce commands located at ds:dx, which
% F7 c$ t7 [! w1 B  Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! p! t* T: R: g  |% r1 X- T
; C. ?6 ]( n4 Y  g4 P4 w
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- `; t" B# `* ^) H' L$ f5 N___________________________________________________________________________
. Q# C7 \3 p- B" h) i, y$ z4 ^9 A/ {, m' Q4 e

; I  g5 d, r/ Y$ a) V6 QMethod 03
8 n, K3 L9 `5 ?9 M9 m=========) l2 i! b% C, b$ j. U# ?  `$ V

" F" o1 \$ \6 F: HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 m5 M$ U9 y0 j- W# ~
(API Get entry point)
6 V) b: Z8 g3 `: m" D        
# U6 u, C& \  ~/ b( w/ S# I6 j/ X* |. V% L* \
    xor     di,di* n- V4 J$ X7 `+ J
    mov     es,di+ m& \+ S- m; K
    mov     ax, 1684h       ' u9 d; }3 ]' O! y4 H' M. n
    mov     bx, 0202h       ; VxD ID of winice
- W8 d+ U- Y2 y4 p9 p    int     2Fh
1 x8 J6 z# X' b1 C0 Y, M" {* Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point) s  w# t7 F2 [# J
    add     ax, di
2 _/ E7 G3 _4 h/ ^7 j% Y    test    ax,ax
: w0 x1 K* d# e& ^3 ?    jnz     SoftICE_Detected
2 B+ \( `" P) a
3 o- s# l8 ~! T. _$ R: B___________________________________________________________________________
5 S$ r  m- Z; P% n7 T5 o5 n7 u( _& o7 W$ L) g3 ]. p
Method 04
! }; `: L  I1 N4 i=========
- e( j+ W! d( e  ?5 ]& o7 {& w
" F4 B: @' K# k9 ^Method identical to the preceding one except that it seeks the ID of SoftICE/ R0 B4 P9 H7 v; j0 B. F
GFX VxD.
6 R$ g) t1 Y! I
' P+ I* Q) l+ f; K    xor     di,di
: t/ o" z; P' P  u: o1 t  I    mov     es,di
' ?. p8 y+ Q2 u- Z# g    mov     ax, 1684h       6 @3 \2 u8 O4 b1 d1 _
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ C: z* }5 b4 w; j7 L3 o& Y' h
    int     2fh
3 \8 V" s+ k% K4 M' P3 u& t1 ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 h1 \+ v# z* U9 T! }+ I$ ]3 ]- [    add     ax, di2 d: w6 R9 b% P8 ^1 z9 @- N  {
    test    ax,ax
$ e3 ~0 g# f8 A6 F8 C7 P    jnz     SoftICE_Detected, X- G2 v$ M2 \1 b, a

& g; k; P- k$ Y4 p2 g7 R__________________________________________________________________________
& l! j/ R, t$ F5 r% Y" [6 K9 X3 [% u
1 R' X! @/ S# j) T1 M5 a
2 l' N5 y5 S- i/ DMethod 05
7 S4 R3 i( l$ c( l=========
' `9 y, ^# I; X. u
2 R4 o0 L3 m) s8 I6 D+ vMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. C1 ]9 _( o: q% ydebugger. It calls the int 41h, function 4Fh.
* [( z  |0 f9 G6 ZThere are several alternatives.  3 x+ G4 O( N2 M

5 \/ T- g+ U  r9 B0 ?The following one is the simplest:
0 k8 _( {' d; b& ^- O2 g: H: P
0 D1 z# ^3 _* P* \2 n7 }7 Z    mov     ax,4fh3 _0 Z$ l/ E2 e# t% y2 T+ \7 J
    int     41h$ }7 E& ]/ j) Q
    cmp     ax, 0F386* `0 i) q9 d% u+ n5 _" a8 k: Q
    jz      SoftICE_detected
# C+ x/ r& Z4 D! N3 [0 p# q& o" A. Z' j4 ]1 f: ?4 M
) y& W# u; v3 u7 Y! {
Next method as well as the following one are 2 examples from Stone's 4 m) m, d7 J- Q/ ]; y! `
"stn-wid.zip" (www.cracking.net):
8 }; n2 I6 i! c7 c4 r* I8 e5 C" [3 t# F7 K) I4 d4 b
    mov     bx, cs/ V% o6 Q2 j3 O* d$ ]
    lea     dx, int41handler2# U) Q3 n2 [1 g2 c; O) g( N
    xchg    dx, es:[41h*4]. L4 u) A" q# y+ x& X
    xchg    bx, es:[41h*4+2]3 O: C6 e: g2 Z1 A+ ]% S6 t* p
    mov     ax,4fh, f( C& u8 C" W+ S' [+ n
    int     41h
0 V% A/ d7 m9 f7 P& U$ a    xchg    dx, es:[41h*4]. c9 F6 _& ~) g, _4 K+ F7 h
    xchg    bx, es:[41h*4+2]
. J# S' j, @+ d    cmp     ax, 0f386h4 F$ c5 C# G* ?- b2 i
    jz      SoftICE_detected
$ n# U% r8 w& N" p4 v1 ]
+ u( U. J; @  w- i$ Eint41handler2 PROC
! T  n7 B7 Q% r/ j/ n9 n3 b; [# w2 m    iret: Y$ N# C2 L- E1 }5 ~: @
int41handler2 ENDP
: G; r1 A% c% t9 M3 s- s7 C: G( m& h' e& N0 ?: V
+ \- L' ~" n6 |3 n
_________________________________________________________________________
3 S9 T7 ~/ L9 b, v9 d" o0 [# z; }1 o/ G

% N6 f! U" ~) |. L- y6 H% l. xMethod 067 [6 |& B8 b* G  F' B
=========
# H& p& L4 v' a2 e& G3 _' v1 g
! t( D; X+ h, I+ c! u* S* i3 Q& ]
2nd method similar to the preceding one but more difficult to detect:; ?& s: B* L5 Q* A. [/ p6 M6 P: V
% A1 q  J8 ?5 [* y5 F( S' @
) ?* A* d/ g3 ~" ^$ T
int41handler PROC
# W  U8 J  X/ O4 i    mov     cl,al
% O# ~% ?" F7 ]$ ?, _3 \+ s    iret
: |4 \- }1 @' b  r4 s  }( T2 _int41handler ENDP
0 @! ^9 ~0 M) ?: C
3 |9 T# Y9 u/ A& y! d( g
) ?: ?, K- \- q% a    xor     ax,ax; J3 a8 |! |% J% W% C
    mov     es,ax$ k: X+ w( i9 V
    mov     bx, cs8 R  c7 d" M4 g) N/ n+ ^
    lea     dx, int41handler$ D! e  @8 }+ o# }5 L7 C3 I- s4 I
    xchg    dx, es:[41h*4]
6 N  M# L7 O; r: v% W3 ]9 W    xchg    bx, es:[41h*4+2]8 X/ G4 B+ J6 G8 x2 u# Y2 ?
    in      al, 40h
+ L2 A+ e- W- l/ S3 W/ h    xor     cx,cx- x+ h& O- ~: ?+ \+ E
    int     41h# _" k$ a9 A( {, W; j8 e  M  G
    xchg    dx, es:[41h*4]
& W! [' b# s# u9 ?    xchg    bx, es:[41h*4+2]& x* l  g; t$ S: V8 y8 X
    cmp     cl,al
" O& V, I8 e+ l( [    jnz     SoftICE_detected
* |7 B) \! ], {  e" d
* {8 Y. p8 n2 x$ U_________________________________________________________________________4 N* _+ t( ^9 K  L, g: c
2 a" }/ K1 b, K5 p1 A0 d0 e3 ?* H
Method 07
0 R3 H) k* o  ~8 k- ^=========
( [* Y! g6 z& Y, q# @* ?' W* x( `% l1 u# |
Method of detection of the WinICE handler in the int68h (V86)
8 ~! f' a+ n% j6 u$ f) ~- n8 n% M0 G5 R/ C% p' `2 r
    mov     ah,43h
  K% w3 w. w' u& I% q    int     68h
, [, a8 }& x0 _7 W    cmp     ax,0F386h, k6 l0 n& A- l- m4 y' f* |" j1 D
    jz      SoftICE_Detected
  ?) w+ N* U1 \: E0 |
7 j+ K' C4 H( m0 g- X4 G0 B
- p6 U* ]6 |7 q3 C4 n$ v=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" W- }5 |7 Z; i: g4 z4 W; w  R5 k2 ~
   app like this:
5 q; F) E0 g1 P
* L& {0 }  y' p   BPX exec_int if ax==680 A. k7 y) O4 o! l# C6 K) e
   (function called is located at byte ptr [ebp+1Dh] and client eip is
' ~! E2 K; f- e0 [' z2 L$ m   located at [ebp+48h] for 32Bit apps)
1 x- B- u' B1 L# s, K__________________________________________________________________________) ?( H! ?. j& f- o% i5 e
( r1 B! Q, g+ E2 y

( c5 I% G6 J- s( J9 O+ O! L! JMethod 08# ~. l. H. q% p5 u# k# B/ R/ }& T
=========
/ {6 B; i* m6 Z9 w
: p; ]: n( Z1 C4 n$ Q+ I; @4 @/ yIt is not a method of detection of SoftICE but a possibility to crash the
, B; |; H5 L: X5 }% csystem by intercepting int 01h and int 03h and redirecting them to another' \, Z/ I3 W, O- D; \' f
routine., k( b" `) u4 n! a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( o3 V6 B( h% b+ q2 U' s- Xto the new routine to execute (hangs computer...)
4 P0 F- o4 `% Z
8 k- K/ U5 {9 }1 w  U' ^    mov     ah, 25h
! u2 Q3 K3 h" j( Z' l' ?: i    mov     al, Int_Number (01h or 03h)" y+ C! ]6 ~! o# D; w# N0 W
    mov     dx, offset New_Int_Routine
1 L7 w4 G8 ~% K' D) u    int     21h
0 ?! G) z  V( @! q1 \- K. K
' D* e7 l- m6 q6 Y( j* @+ n__________________________________________________________________________
! U. t* S6 G3 ~: @8 Q" u7 p% T2 w) o2 i. ~5 Y2 r' \
Method 093 w+ M) M( N2 j- x3 S: G$ H
=========$ T4 n% u% n. `6 J" i

' C" K# g; `( I/ l8 hThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 j. Q3 y, Y0 l5 U2 [performed in ring0 (VxD or a ring3 app using the VxdCall).' z7 Z% K$ j- e7 U( z0 l. }5 S! E
The Get_DDB service is used to determine whether or not a VxD is installed
1 x- E3 z1 x* P, r5 }for the specified device and returns a Device Description Block (in ecx) for
* r9 E2 q6 Z, @( ?/ x) ~) Jthat device if it is installed.$ c+ Y5 H' `) |2 e4 f/ b4 X
/ p1 _' x# K8 P5 X) r" F) a# Q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
* `7 n' B" e% I" Z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* }; i+ H- H$ v4 L4 [, O
   VMMCall Get_DDB
: t" Y, o' F/ \; q' p2 A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 s, H5 c- Q7 I' `

0 i8 K, ?  |% D+ p2 B3 i- ~Note as well that you can easily detect this method with SoftICE:8 L4 ]+ [" n2 |2 w% L
   bpx Get_DDB if ax==0202 || ax==7a5fh
: w) M' H0 `  a/ v
5 A+ Q+ T& x. Y/ H, I__________________________________________________________________________
) B  c4 ^3 C2 @" n6 I/ W7 j5 r( [2 e0 Z: p$ c
Method 101 U. a9 x' B) Z- p* E
=========( ~1 }+ s: p3 V" g
1 o, B8 s; {& z+ D2 X3 K$ |. K
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
2 _1 k+ R  j# m7 @6 ]$ F( Y  SoftICE while the option is enable!!
, ^# n, J" S2 Q1 n) I4 X
3 ~" N: `7 E; n6 @- gThis trick is very efficient:, Z  m% o: y' }  Z" v  R* v
by checking the Debug Registers, you can detect if SoftICE is loaded5 d# h- ?" a  }) @' H5 i0 R
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& Z/ T: P- Z6 }/ S7 T& I6 g# J
there are some memory breakpoints set (dr0 to dr3) simply by reading their
: U% L; C& Y. ~$ ~- D: e  Hvalue (in ring0 only). Values can be manipulated and or changed as well
( d- ~  R* ~1 S2 D. z8 \(clearing BPMs for instance)
/ ^. @% h7 [% r( M; \+ o
' N  z# ]' K9 C* b+ c$ X__________________________________________________________________________
! y- A2 `9 K: z4 E6 y7 z5 M4 v' O; G7 U, ]0 @% Q& q! p
Method 115 I5 R! x+ h9 e3 Y! x1 v
=========
, o4 s, K7 S3 ?$ P3 ^* u# n: E# X  w
This method is most known as 'MeltICE' because it has been freely distributed8 ?7 B: C+ z: t) q
via www.winfiles.com. However it was first used by NuMega people to allow4 |6 k9 i8 F% |' f- o& L8 @
Symbol Loader to check if SoftICE was active or not (the code is located: a+ H3 ^( x' v' z7 g4 `& x
inside nmtrans.dll).: F( ?, g) B) @( x

% A. N6 w/ I3 U, h, F+ a: ]# H7 zThe way it works is very simple:
% b2 s; z- A) Y9 ?It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
( V  \1 x& \; q1 O; h: c! j$ I5 dWinNT) with the CreateFileA API.
2 e" Q! R  H- S0 ^
. J3 X9 W) p7 m9 Z6 x3 kHere is a sample (checking for 'SICE'):
6 ]& @1 B' Y$ m( N
$ o1 `: G# P( c, b( P; h8 Y$ K3 pBOOL IsSoftIce95Loaded()
4 v, y0 i* h( {/ R+ ]) n{
8 m3 Q; J8 }* g* W   HANDLE hFile;  
! a: ~) t5 b, g' A% x   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) N; Z6 S/ n" U2 R/ H. w# C( O7 t
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. f; O' m0 d8 N6 S; n; s" k: T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 U2 D, u9 w/ x. y% i" g   if( hFile != INVALID_HANDLE_VALUE )( p, q( Q- r9 K
   {
. o. E0 y$ {: D* Y  @% ~% F      CloseHandle(hFile);
$ n8 E3 Z; x2 [9 P* \; U      return TRUE;
6 Z/ O" x) }. y& _; W4 |8 b   }* K) \& B9 Q0 k0 t1 D- M
   return FALSE;; k. M( }/ O+ V; T2 e
}
- `$ o; N: T, k4 c& y. u: W* _  r  y0 b
Although this trick calls the CreateFileA function, don't even expect to be3 R4 ^  o7 {, [7 i$ z2 l2 y0 e5 [
able to intercept it by installing a IFS hook: it will not work, no way!
9 ^& `) l! U3 z8 S# {0 p# QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
  i+ b0 o) C  P2 ?# H: c& \service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- o4 |$ F$ X0 n. K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 Y- J. V4 e3 Z$ gfield.) H* z: B+ J* C* x
In fact, its purpose is not to load/unload VxDs but only to send a ; i5 C1 a) T0 T1 M9 N/ B% U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
8 Z% ?1 {( A: @: T  D4 h5 c* @& qto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ n9 x1 l, s; @5 R4 i  x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" K" k3 i7 S+ l6 r3 M% Y# y3 tIf the VxD is loaded, it will always clear eax and the Carry flag to allow
5 p6 r! N/ w; sits handle to be opened and then, will be detected.+ {/ [/ ~+ i) f, K5 @/ v
You can check that simply by hooking Winice.exe control proc entry point
7 k6 }* B, z, ywhile running MeltICE.
& e! V. Z3 S0 \7 s4 k( ?( h' e5 ?1 [5 P! ^9 x, C
6 l* ]9 U0 u4 d5 F% V. X
  00401067:  push      00402025    ; \\.\SICE2 T0 E/ A( n  v9 M# H
  0040106C:  call      CreateFileA
/ v; ~* Y3 v- _0 T% j" h2 \7 M. U  00401071:  cmp       eax,-0015 J  S& Y: [/ m4 ]% F3 s6 w8 @& m
  00401074:  je        00401091
. i4 z2 [8 J0 p
% ?$ P; ]8 @3 v. {+ @6 {6 `3 |1 ?( X& F* v7 f
There could be hundreds of BPX you could use to detect this trick.
1 A, X" B4 S( ?9 \-The most classical one is:
  r& S$ D% Q8 i; W5 z" b  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 _4 K2 {8 N" I- j" T& t    *(esp-&gt;4+4)=='NTIC') ^' f$ j0 |- c; m% f

7 I8 K) M6 \2 I3 D0 i4 w& T& q! U-The most exotic ones (could be very slooooow :-(
7 H1 T% S% _+ ]* t1 X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
& U$ q- X  H" N6 N2 ?; ~; e     ;will break 3 times :-(/ ^# a7 B! D# g- }! q3 R
7 m( K1 o! O3 T
-or (a bit) faster: , J+ Q( o2 P" ^3 n
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
( C* f% j8 W( N; r  @7 ~2 }; F7 s6 U  U1 D
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
4 T1 w  b6 S  @* U! u     ;will break 3 times :-(8 l$ K6 E6 {8 i! Z# F9 l
% z- r  G! g6 I" |0 Y  l- }+ [' C4 s. q
-Much faster:
# P4 C& v6 A) P3 N   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': N- D1 N. |( d

/ ^1 L& y+ w* Y3 C% w0 w- C  `$ }Note also that some programs (like AZPR3.00) use de old 16-bit _lopen) ^5 b- [2 [# ~, `( Q% Y6 u
function to do the same job:; }5 n$ e% Y! x2 W' ]4 X
- M8 L, M1 R- @' T% E  |7 M
   push    00                        ; OF_READ$ |7 L$ Q$ d: [" ^7 T+ K7 S
   mov     eax,[00656634]            ; '\\.\SICE',0
, a% w0 u2 C) N2 V' o% j7 c/ o   push    eax$ Y3 A6 A$ M6 s, c+ y
   call    KERNEL32!_lopen4 o4 P3 |) q$ K( O5 `
   inc     eax6 U/ B: e7 _! u9 G$ ~& v6 l% o
   jnz     00650589                  ; detected
% A4 f  k2 o9 ?0 W   push    00                        ; OF_READ% f7 F: ^/ b" ~
   mov     eax,[00656638]            ; '\\.\SICE'
) P7 Q. P" {9 W. m) Y5 C   push    eax
  d! ?, X: m$ U# b2 t2 D3 s   call    KERNEL32!_lopen
! ^! h5 s: R: ?/ u% b  y: t% }& n   inc     eax
9 W3 _, \9 P+ E' {' l$ K   jz      006505ae                  ; not detected% K# v& ]. l7 F; ^
( F  m- q9 k% d1 N

; f: D! \' j* B: `1 B# f& C__________________________________________________________________________
4 E6 J* b! \, u$ s
% }6 g0 I3 v, a- _6 RMethod 12' M3 ^. E7 N# A  c, V% f' S. z
=========
0 T7 D3 C. a; W2 O* X; k, o# p: X# j2 y& }
This trick is similar to int41h/4fh Debugger installation check (code 05
  Z  d7 K0 ^: g; }&amp; 06) but very limited because it's only available for Win95/98 (not NT)( T  k  a0 M( y/ P2 k, z: u
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 s- n  X- u- Z! U' U2 _5 f7 a; _

/ [, e4 F. m# ?( _   push  0000004fh         ; function 4fh- P: a  r/ t1 _
   push  002a002ah         ; high word specifies which VxD (VWIN32)7 u9 O& x, D8 \2 C# L
                           ; low word specifies which service& k5 ?$ _0 ]; G$ B8 G
                             (VWIN32_Int41Dispatch)& E2 M* ]) F6 [9 w) K1 _" H" t6 l& o
   call  Kernel32!ORD_001  ; VxdCall/ q6 D& \* k6 A
   cmp   ax, 0f386h        ; magic number returned by system debuggers' _. u9 W% E  q/ F# }: U) ^
   jz    SoftICE_detected; m4 S6 B0 j2 ~" ~* U

  z/ C) @3 b. H0 `# c4 gHere again, several ways to detect it:
( s4 c8 X& T* C6 B" u
$ u* o+ P* o5 A: G' M3 ]- |    BPINT 41 if ax==4f4 C' N6 k! f" W9 E8 Z8 H; J
" Q" u8 p0 f8 o* D- i* |5 |) I
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! S# R4 e- Q  Q( ^. v& T9 Y3 h
; c) @7 _- e" U5 v8 q  A; B
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
# E& ~2 d; H  Y, k% n, l# g0 u% p) o* G% x/ W5 d' t9 O( h
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, j# W6 V/ B( W4 p: h9 O
4 _, H; _2 b# i0 @) [
__________________________________________________________________________
3 w6 Z$ D) }4 \- R: K7 {9 w9 }4 \0 A( Y8 _& T; |# Q
Method 13) I1 K: U4 N' ~- g0 g/ F5 R! [
=========
3 ^# y% T! y5 S% O- w8 q; a1 }! p4 w5 n4 o; I
Not a real method of detection, but a good way to know if SoftICE is
9 {  m2 m4 r) O3 o* `  xinstalled on a computer and to locate its installation directory.4 @  v6 `' ^6 U" r+ \# y  U1 t, z
It is used by few softs which access the following registry keys (usually #2) :
3 Q/ p+ f/ y8 ?+ t, |* v/ V  p# e6 q
2 p8 X7 V% h& w/ ~-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ l5 |8 S  W( y5 g+ J2 F3 S
\Uninstall\SoftICE6 E( P6 s. f- {; t! `
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ k, l5 r& t  s! B-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  W/ M7 @8 {7 t\App Paths\Loader32.Exe# G* F( [+ S* P/ [4 f+ r) f% f6 T% {

3 F. m/ V" T" i3 E3 ]2 c: s/ ~3 y  u5 K; K
Note that some nasty apps could then erase all files from SoftICE directory
) H4 {  b1 u5 `7 ^(I faced that once :-(: T. u* b- d/ u8 m9 j- \! B

% J3 Z# K5 w; z3 ?Useful breakpoint to detect it:
% V: }3 e- Q( F+ b
: a2 `- g5 K2 v3 X: _4 a* m     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
7 m: `9 H* v& m2 e. W0 D& s; ~0 ~
7 y  l1 @6 l$ \6 f* p* h* u0 |__________________________________________________________________________; C5 r% G  U5 F8 P

  |. _; b( Y# q# y# z5 |4 ]8 O
( \  }% g5 \! i, M$ HMethod 14 & I7 ?( s: o. ~, S; ?7 \
=========7 M- `/ c  @. S7 M- o& k( s

9 F  u. B" Z1 i5 e$ C2 zA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 t- _* U1 @: d1 @7 g) j
is to determines whether a debugger is running on your system (ring0 only).
8 K9 i0 B- l# M3 |9 {. ^1 Z2 [2 c% |
   VMMCall Test_Debug_Installed3 G0 u0 E+ U7 g3 q3 B, H7 a
   je      not_installed
- y* Z0 k/ p& P& h
9 _! ~# r4 Q2 Z7 y, ?! hThis service just checks a flag.0 O4 h  d, }( t) |
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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