About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 t$ }1 @' h9 y2 y6 `2 R! X
<TBODY>
2 a1 V# X+ n, g9 D2 l7 K: |<TR>* j6 U! u' A" y8 t
<TD><PRE>Method 01
5 Z6 K+ J' ]: I& ?+ C: M4 B=========
9 Y8 X- ]4 Q8 b) Y3 X  o  [# G2 A! z( z* m0 l1 v
This method of detection of SoftICE (as well as the following one) is9 _# q4 [. H0 L3 M% M6 A
used by the majority of packers/encryptors found on Internet.
3 V& B/ |8 O* P! @* B2 |8 @It seeks the signature of BoundsChecker in SoftICE$ o0 k5 J5 t8 r: N! W8 b

. e3 d; \4 r' i* m6 G! A- Q    mov     ebp, 04243484Bh        ; 'BCHK'$ l3 d) Y0 j& m
    mov     ax, 04h
1 S1 k8 f: w6 X0 }2 }    int     3       * N* l9 Y& c/ P2 q% U. X* k* l2 e2 K
    cmp     al,4
* j4 P5 i5 O, `# V    jnz     SoftICE_Detected
6 i. N9 }; H" E! e3 D! R
8 X* Q) ^9 c! @: X- T% L9 P! P; O___________________________________________________________________________, Q* `0 H% {* Q, f( P
$ A& O* D$ a4 ^8 D& s
Method 02
. \6 L% h7 i' F2 I" T! T& b=========% Y& E  H" Y$ Q
- [9 ]9 Z3 v5 r) ]- k; p
Still a method very much used (perhaps the most frequent one).  It is used2 q# l1 q. Y6 |2 J  C3 I% C7 J& \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,! w& E' T. p5 B
or execute SoftICE commands...# k# }# x  F: ~4 X9 w1 p
It is also used to crash SoftICE and to force it to execute any commands
# u' f" H0 F% [( E0 n" z  o(HBOOT...) :-((  * ^8 D6 V4 s5 L6 M# C

4 m8 l& M1 V: M, x: _: W, j9 `8 HHere is a quick description:
. N1 t0 I1 E! x. m) S-AX = 0910h   (Display string in SIce windows)5 g" ?6 F. Z6 W- v) \0 l8 {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  V0 O( v" ]- C% B9 U; h
-AX = 0912h   (Get breakpoint infos)
% `; q  \. W& Q$ w-AX = 0913h   (Set Sice breakpoints)
: e6 k1 G0 @9 P2 _-AX = 0914h   (Remove SIce breakoints)$ K1 e* e6 |% ~* g3 S

8 D& ]. k+ z9 ]( G6 T; lEach time you'll meet this trick, you'll see:
6 _" {$ @! i+ O# e# }* @5 ]$ t-SI = 4647h
) }& d' A7 U( M% D' X+ W-DI = 4A4Dh
. b8 }  D" Z4 S5 ?$ WWhich are the 'magic values' used by SoftIce.
7 p# b# v$ p' u9 V. X7 VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
" o( b' P+ M9 q1 W. k
% g) B8 q3 l! s/ P5 VHere is one example from the file "Haspinst.exe" which is the dongle HASP* w( k9 y$ O2 Z# v4 h
Envelope utility use to protect DOS applications:
$ G- {' z: B2 J1 l, u
( K3 i6 i, N  j; m4 p" m
5 T( U# P; Z- O! D; o4 H  l# H4C19:0095   MOV    AX,0911  ; execute command.
5 J- T6 ?9 F. d( ^. r8 g. F# I1 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- p& y0 C- |! z, D) n' g4 S
4C19:009A   MOV    SI,4647  ; 1st magic value.
2 y; b! a6 P5 }0 N( x' [: C4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 ?- o; E3 N4 z2 O+ r0 {4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 u/ ]. ^) i6 [# `4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
4 X" e2 l" k1 B* n% d- C4C19:00A4   INC    CX  X8 M0 y5 V! J  o3 c4 K
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute! e2 t/ ]% |7 w; ]
4C19:00A8   JB     0095     ; 6 different commands.
: r- Q$ V3 @& j4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
( J' q0 a- [5 P5 ~, g% z2 T8 l; @3 s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
' ?( C9 ~7 _, d! R$ n- o7 v- n9 c
+ U. i9 Y+ \0 |0 aThe program will execute 6 different SIce commands located at ds:dx, which
; z  F% b; h! w6 K7 n9 p; Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 Z8 ^' Y$ E4 Q7 V$ J
; V3 i" W" @1 J1 \# P* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; ]9 F- Z% I; X" U: g% [/ O
___________________________________________________________________________
$ i) q* I( k# i" N/ H
2 v* P$ o  H* V$ H; I8 ?: O% `* c" s; p* f9 B% ~5 E
Method 03
4 M& Q. @& Y+ [1 D- R=========
" f' N7 |* V6 p; A9 G0 R. C3 A3 m# Z& @" h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ I3 Z2 r* k) R/ d* i(API Get entry point)
( @" H5 j- ^# m# n+ N/ q6 d7 q" Y        - c! e7 k$ y% F" P* o

9 J( X/ j- X9 Q6 o    xor     di,di% ~$ E* u4 U) o0 m7 D
    mov     es,di& R2 j% c2 R! V4 m) o
    mov     ax, 1684h      
5 V, [8 f# o0 M8 x$ T    mov     bx, 0202h       ; VxD ID of winice( B) X' R+ q% ^$ @! M: p
    int     2Fh: f8 {* s6 M& o  t4 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" T' b- N' m4 \' ~
    add     ax, di
! m; ^1 L3 u# Y& g# L9 B    test    ax,ax
0 L4 |" u! v4 H/ e* `+ A; G; Z    jnz     SoftICE_Detected
# h& H/ a2 I" U  j( I) j; G! R* h! A
___________________________________________________________________________
- K1 d7 o5 ^, i' F( H/ k# `7 R
1 X8 p( T  s: [- _7 r6 N# q. G+ xMethod 04
; O2 {+ C( Q5 N4 l0 p6 y=========2 m% J' ?4 D$ M- @" v: O

- U! I0 k" B+ P0 b2 E! o, ZMethod identical to the preceding one except that it seeks the ID of SoftICE( b6 A: H) l3 x9 o
GFX VxD., ^7 A+ @7 G- C* A& y$ u

7 }3 r* L# w8 O% n    xor     di,di
  W2 T' A$ b/ \    mov     es,di2 ~3 v" ^! ~2 z6 h& C, Y/ [8 o- w
    mov     ax, 1684h       ( t1 y/ j& k# V; d8 Y, Z
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 O: J) G! w8 q5 I    int     2fh  q* [& U% b* m* h  R7 }7 c
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 t# X- l' P  Z. k( S
    add     ax, di0 O& e3 z8 ]! m, Y/ P
    test    ax,ax" ~$ r& Q; X% F2 e
    jnz     SoftICE_Detected
. v& P3 @6 H& i6 X6 a0 Z# s1 ], `# G
__________________________________________________________________________, I% x* Q, B0 W% F6 H

1 Q0 f  @' ~( H1 Q
6 O% F3 ]+ m) M6 V, A0 jMethod 05
/ g) Y9 K4 I  }6 x. J6 T=========6 W; m4 X) m( F7 G/ Q* z! c, m

2 g: p5 j+ \7 |" ZMethod seeking the 'magic number' 0F386h returned (in ax) by all system' e; q2 h# X  }  P
debugger. It calls the int 41h, function 4Fh.
7 n/ O9 O. O3 A4 e5 HThere are several alternatives.  / S& r% p  X1 ~' n- w! l
7 L5 \7 x7 y6 a! z: r3 q' A) C
The following one is the simplest:
8 y& F* l; j& J- y1 O# Q! D- E3 v. X" `7 ?
    mov     ax,4fh) f9 u! ?! U3 p7 }
    int     41h% h2 ]1 P; Y3 B/ O" _/ x- n; k
    cmp     ax, 0F386
. n# ^, D8 \2 y4 e* Y( p  i. u. N    jz      SoftICE_detected, n5 {5 X; U& \4 h+ j
! H" n' S( k% f
* P" m- j8 Y/ x
Next method as well as the following one are 2 examples from Stone's " W. H* M2 X) N, t7 o& Z
"stn-wid.zip" (www.cracking.net):1 U. Q& Z  H; I# C

9 P  E/ [/ Q5 e+ k  o( t9 t0 H    mov     bx, cs
' n3 v/ G7 C3 G" p9 N  T    lea     dx, int41handler2" P1 D% G# e! X$ c0 \
    xchg    dx, es:[41h*4]
! W. m, H1 i& |4 R( q    xchg    bx, es:[41h*4+2]+ H6 H  ]: A: r
    mov     ax,4fh1 \6 Y6 @0 n, b, R; C
    int     41h
& b" F7 }/ ]  C  f. C* m    xchg    dx, es:[41h*4]1 ?) ]& j. l6 \, P
    xchg    bx, es:[41h*4+2]
8 \. E( ?0 t% z8 x, c: G    cmp     ax, 0f386h9 q( d( d  T' q: S( T+ X
    jz      SoftICE_detected6 X" O; d, N1 A% v7 a3 [

1 z" k- x0 \4 Q" C0 ^int41handler2 PROC
9 a, _: o! l* L( i    iret
! n+ A) q( x$ D3 ?; x# Rint41handler2 ENDP
: G( P+ O( i- e1 q8 m0 `1 W# q7 u! [8 S/ u# A# X
* D/ v) Z( E% a  N! w3 E
_________________________________________________________________________2 t3 L) H. ^3 ]0 S" u9 {- k

* W( l% k* m: ^9 c
$ u. s9 c/ R! }) Q1 jMethod 06  i/ ?1 c9 h" |0 E
=========2 ]3 o8 P9 ?; O4 e* Z

4 M: d* s+ Z" w3 o7 H: D
* G+ M  G0 ~  [+ d6 a7 f& _6 H2nd method similar to the preceding one but more difficult to detect:) `5 n% @* k  q1 d9 T
* C8 H' L' U3 [& t* J/ t0 n% \

1 w( o( V9 y3 H3 c8 N( Sint41handler PROC
& n, A7 J# B' v3 @- p    mov     cl,al) ^7 l5 V  G. f. I( p* c, C
    iret
4 {. S% \8 {& @! u) X! d  Jint41handler ENDP
, o, `  v0 ?& f- C) Q" \" r# A  ^" P$ b; W5 l% Z* L

6 ~, q+ q2 V/ z6 p7 P% [$ I    xor     ax,ax
  P# ~% k. `0 ?    mov     es,ax
* ]6 O, H- p- W; x9 t& H    mov     bx, cs' l; a3 ]5 n+ a5 @4 o% @1 G
    lea     dx, int41handler) n: m; R) c! w; e$ K) O" W3 S
    xchg    dx, es:[41h*4]  U; @; F- Y( G( {
    xchg    bx, es:[41h*4+2]3 m+ k7 P: L& n% Y/ L
    in      al, 40h; H9 V* x/ u  [% u# o! H. b
    xor     cx,cx
1 A6 M" q* P  `+ e' }  X. C$ Z    int     41h- Y: x8 ~; E4 b( w4 t
    xchg    dx, es:[41h*4]: j$ L# q3 e  }/ M3 P
    xchg    bx, es:[41h*4+2]
/ F" q; k) |' }# F* l% |    cmp     cl,al
8 l' U' m& @; }5 ?' O7 n+ i. s5 G    jnz     SoftICE_detected
% D- D& l& v! E" J+ F: G/ w' C+ Z: j) U" Z5 F4 X
_________________________________________________________________________; r% j! L# W* u* Y9 X0 O
) x* f* a- j( C# K+ G. P9 o
Method 07
+ Z% B) _0 q3 z2 e- a=========
! u/ n) K% e3 O9 G+ X0 n3 u6 c1 N: r9 n+ h6 s! ?: W$ _7 c
Method of detection of the WinICE handler in the int68h (V86)
- }8 f, k! L% C" ^0 }7 ?. o6 @2 n4 L! ]& V( z) a
    mov     ah,43h
/ `! u( S& k7 ^7 J0 \# Y    int     68h
3 Q6 Z" Q9 z7 u1 L6 [    cmp     ax,0F386h
" O5 j! \5 d! C1 `' P2 h; N    jz      SoftICE_Detected4 [3 Q$ N: [$ D3 m* }5 r
: T8 T! p8 {3 O' r- C. R
9 x* I* X& k3 y. F2 m
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" O: m6 O4 q3 a; _! X   app like this:
: E; k$ S. \. h+ |! z8 D0 V3 Y  x9 L( o( O. F. O
   BPX exec_int if ax==68% _; M6 T: u% M& G, m0 {
   (function called is located at byte ptr [ebp+1Dh] and client eip is
' F/ k; G& T3 W* H& q   located at [ebp+48h] for 32Bit apps)
" n6 y6 I6 Q$ _7 w" g__________________________________________________________________________- k% ?' i* u$ e. d( ?2 M4 B. `
$ }7 ~6 L8 ?7 }4 B/ ^+ n" e3 u
/ W7 B; P4 q" l3 d3 u
Method 08
  v9 G+ o. v* ]! @6 m=========1 k! l' ?6 z6 s. `3 ^! [( g# X
6 r7 b3 @4 }$ x$ D) ]5 }3 L! z
It is not a method of detection of SoftICE but a possibility to crash the
8 Z* Q1 Z1 Z* X4 B6 Q5 A, Hsystem by intercepting int 01h and int 03h and redirecting them to another
$ b) U3 _: u0 h3 @8 Jroutine.; ]! s8 u' o- R3 p
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
; a( G- G! d# m1 |& _to the new routine to execute (hangs computer...)& \! B) n8 q+ B0 w" u$ |
  l# H* R* s. \$ |
    mov     ah, 25h4 b: K1 O  j1 B1 _+ E7 ?; g
    mov     al, Int_Number (01h or 03h)5 D7 c# D! x. H7 G7 M$ s  \6 z
    mov     dx, offset New_Int_Routine
- ]% u. e9 ]( ?2 j% B" r! @7 q    int     21h. f: O2 p. E7 U6 W7 o6 Q; y3 [
* g; n- F- n( B' w* |
__________________________________________________________________________) h2 Y) a2 G5 K9 k& c

( P. N0 k8 K, ^- KMethod 09
3 G/ ], X' m0 b, L' x=========1 d: ~! z2 ~7 U3 D9 q& Z5 Z
) q3 m" C# U9 y% r; e8 y+ r( S
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, u! Q' Y6 d$ r3 B$ s- D8 nperformed in ring0 (VxD or a ring3 app using the VxdCall).
0 s6 q# f* A3 L5 h0 W1 [* Y7 lThe Get_DDB service is used to determine whether or not a VxD is installed
* U$ j! d9 W: O9 Kfor the specified device and returns a Device Description Block (in ecx) for
8 f+ @/ ]7 d: Z% Y4 i( Xthat device if it is installed.3 D+ [; _# h; H8 W: z# z3 F
9 h, O4 z& ~5 i2 C3 G4 s7 `) n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
9 x& T! m4 E& ^: E' N   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). x5 y4 b6 l$ l2 m( Q* {
   VMMCall Get_DDB
; ^6 M0 Q  X. k0 S" T, b7 X   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ w% h8 }" x' ^/ j, |' m  |! W$ q3 w6 P! M3 [
Note as well that you can easily detect this method with SoftICE:6 [/ ^' _# P7 R3 r. ~
   bpx Get_DDB if ax==0202 || ax==7a5fh
: ]1 y2 }7 v( Q8 F1 c3 @8 q! F6 }2 A, U0 Q  e$ q: A' [
__________________________________________________________________________  m- F( H8 Q7 d" {

7 |& _1 _" n  R* l' g, }& e8 wMethod 10! X  B# G+ n9 l6 V  i* @9 }
=========3 J# E/ G; D' E: I/ c
: n- a! J' A5 q3 H6 \: s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, C! t9 P7 p0 r5 A
  SoftICE while the option is enable!!
/ n  U; \1 t+ q& M8 B7 r2 O& @( R9 M& H0 k1 r# V1 x
This trick is very efficient:
) X. u% ?$ I# z3 I0 Nby checking the Debug Registers, you can detect if SoftICE is loaded# w# W% q( i1 u# e- V" I
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 f5 ^6 g7 Z2 d; xthere are some memory breakpoints set (dr0 to dr3) simply by reading their
$ x; I' y$ g; `# vvalue (in ring0 only). Values can be manipulated and or changed as well
: h4 H( c8 o  f- }- a(clearing BPMs for instance)
% W' O/ s: ?" d) m  w, i; [) k
" S. d* Z! T- o# b" e/ K$ ^__________________________________________________________________________7 |0 V5 o# w7 l2 Q) ~: Z) [: j
3 c6 X! L2 g2 c
Method 112 I' k2 `6 `5 t- |( \
=========
, s0 e: ]' G( Y- v1 _3 V4 R# c- Z0 d7 K5 P
This method is most known as 'MeltICE' because it has been freely distributed
4 E$ O9 b6 J0 h: q+ `! C, L! gvia www.winfiles.com. However it was first used by NuMega people to allow  ]" G3 R! ^  |$ R
Symbol Loader to check if SoftICE was active or not (the code is located
; S9 s. s; d# [" R. B2 ?" Xinside nmtrans.dll).# z1 n  i- V( r
5 c1 Z. l/ J5 J: n, j, J, U
The way it works is very simple:
5 {# p" {# q) |( C$ `+ O" PIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: ]# e8 S. G  q0 OWinNT) with the CreateFileA API.1 |1 A. Y/ w3 a7 J- y
- w( v, y; C' O  ~3 `% t# v
Here is a sample (checking for 'SICE'):
- g) e0 \0 w0 r
) W; ~( h+ }5 Y3 lBOOL IsSoftIce95Loaded()
3 g, b/ n% J2 Z/ X% o& Z{* G) @! @# i( A& L
   HANDLE hFile;  % H  s: \0 u6 Z0 U  e9 ?" ^
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ L' I9 k" W3 \- z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 A# a/ J4 S  F5 l  O& s; F: ~$ X! T/ A                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: [# m$ j; d; H4 j! x* F6 i   if( hFile != INVALID_HANDLE_VALUE )$ i6 A: g. ~8 \* R7 [' q
   {
/ F% V1 B, F/ u/ v' I/ s& C      CloseHandle(hFile);
; m4 |; p& _& g' D) B& f      return TRUE;
9 h/ L, z, k: o  R3 T   }
* d: F9 J2 p3 w   return FALSE;2 J( `* z' c$ G- |# F
}
$ `6 [) ?/ o. b: m
. O/ o9 T! P' ]& ]5 I) P; gAlthough this trick calls the CreateFileA function, don't even expect to be8 N3 p! {- X0 i- N7 t
able to intercept it by installing a IFS hook: it will not work, no way!
% q. x" w0 o9 c- p7 b# B; oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F3 ?; ~3 \( W- Q" y7 I( \' Q& F
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" X! {3 d9 a3 _and then browse the DDB list until it find the VxD and its DDB_Control_Proc% S+ ?1 o6 |) i, a# X4 l
field.
4 f; ]0 [! i2 v% i" c0 b! QIn fact, its purpose is not to load/unload VxDs but only to send a $ x. G$ D# ]$ R1 [1 }
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" z( q6 r; f# q, E; C9 q) T- m
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
: F- Y. U) _. |7 I8 M& ?7 k& Gto load/unload a non-dynamically loadable driver such as SoftICE ;-).* I* W3 n5 Q" r' ^
If the VxD is loaded, it will always clear eax and the Carry flag to allow, f3 G+ Y  p5 P
its handle to be opened and then, will be detected.' C- x, B) m& g* u3 S! l
You can check that simply by hooking Winice.exe control proc entry point) i& a& b+ G# c1 w
while running MeltICE.
8 l' w0 H' s# C% V8 M& g
5 V; H! m4 P6 l4 U  K
! `4 n+ b- `$ A$ s  00401067:  push      00402025    ; \\.\SICE
, ^3 Y! I' M, i4 U, Y  0040106C:  call      CreateFileA6 ^2 `5 w9 D+ p& e# j5 @
  00401071:  cmp       eax,-001: _+ c) _6 w1 i  p5 C' ]9 ]6 G+ q+ I
  00401074:  je        00401091
% q7 f- a- R* R+ m' R. U8 e2 U! }4 q9 d7 O  U- U

" R, ~5 Z0 ^8 y7 xThere could be hundreds of BPX you could use to detect this trick.
6 a9 W' r4 u7 W-The most classical one is:
- n6 s' A) F6 N8 @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& `: c8 s( o* Y/ b
    *(esp-&gt;4+4)=='NTIC'
4 V2 d0 e: B- ~2 }; ^' t8 R% A: b. D& z& `( M4 t* a. E! w& X+ R
-The most exotic ones (could be very slooooow :-(/ R* |4 |  I: e, {5 o
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
# X$ G6 V9 O; U. E/ F) e! U2 P     ;will break 3 times :-(
! U6 {: }% f- f! B) p9 V% ?4 A; Q# y4 y
-or (a bit) faster:
0 w+ m) O, I0 y9 z" a2 k+ k   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ i; O$ h5 y4 {

6 M- ^; _3 B0 ]+ C* U   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  & x# q0 g6 {. p" j, _+ c
     ;will break 3 times :-(" E! \- X2 S; M) O

! }: B; a* r- f' k-Much faster:
! \6 f3 }! k! R8 R& T+ L4 O   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 J$ c: o( M3 z! ^9 [
* Y6 s- [4 C3 V: X# m+ S
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# C! `' l6 m4 ], a+ t. @; Cfunction to do the same job:. _$ l$ }" `% M8 U& z
+ o# m* B, u1 I9 N
   push    00                        ; OF_READ
' T9 J# m9 G2 z& [   mov     eax,[00656634]            ; '\\.\SICE',0
+ a' a$ Q+ g2 s. o6 E9 L   push    eax
0 E$ H& D, O. ^   call    KERNEL32!_lopen
  E; _5 ~  @$ f" l( t+ I8 A   inc     eax
6 B( t# ]% c: ^  j   jnz     00650589                  ; detected$ V2 k& @9 }( O1 A
   push    00                        ; OF_READ- l$ z1 L, k$ K9 R
   mov     eax,[00656638]            ; '\\.\SICE'
0 \& D9 c! [6 S( p' k! x* J   push    eax
: `0 h5 u+ i9 F. _- _0 ~" m   call    KERNEL32!_lopen0 Y4 Z0 l1 [9 M$ ^- h. O$ U
   inc     eax' A; x; H* _4 r6 W- p9 J1 _  F
   jz      006505ae                  ; not detected+ i/ E" |  t8 W6 g: s
$ G" i9 ~/ r. B8 [  I  h+ A

) ]" w9 i! @7 W6 I* }__________________________________________________________________________5 D" f. Y. B% F, X6 Q
  o- ~' k; O& Y/ R! t# M" A
Method 12
7 \8 e6 l8 W/ D( |=========6 `( Q: X9 o- k: k$ p9 G
$ ^7 p' m& A" h# r5 i
This trick is similar to int41h/4fh Debugger installation check (code 05
0 S% D! B# G/ H; S! K4 d2 b&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' c2 _1 I/ w# c% E" Qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 l7 s2 P' e) h, G' o+ w) X0 d8 ?0 a3 h$ a4 m( V" x% f
   push  0000004fh         ; function 4fh
1 H, q% N' E! W  M   push  002a002ah         ; high word specifies which VxD (VWIN32)
: v3 L/ p5 W3 ]' ~$ Y2 h! ?$ G5 \                           ; low word specifies which service
& b( X- K5 Q1 p                             (VWIN32_Int41Dispatch)* u+ W, x. [% |' M5 a/ I# G
   call  Kernel32!ORD_001  ; VxdCall
( }+ m2 o' {- @- |+ |& D6 C   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 F% g2 w* a4 V( W   jz    SoftICE_detected) v+ r- A  U+ F5 k* c: l) m

7 v; {* k. M3 c$ QHere again, several ways to detect it:
5 a+ ^- Y4 f, z3 d1 d. l" F! W% E6 S
    BPINT 41 if ax==4f
5 h7 \8 M& |  B0 F% F& L3 L2 c0 r
6 F; T4 n; q5 Z/ J% r  S3 F    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 n) y- w" p9 }0 u/ T9 T
- x$ g5 L! N) N( G! H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
5 z3 z, M" a, Y, \- ?; `4 e% w/ K: C
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 B8 G5 T, [/ L! e: D, u# n
6 |, s1 Z, G0 e0 X, k
__________________________________________________________________________
( x) X' B/ I' u9 ^0 S
2 l1 q. E4 M7 A* e7 ?) s, aMethod 134 F; [) `3 _- D) Q$ O3 W( r# Z
=========
( w+ C) |+ s- r4 `4 K  d
1 t% E  O5 }" i7 l9 D7 ^Not a real method of detection, but a good way to know if SoftICE is
8 R9 X3 G( Z: P6 w5 r  @0 g4 A* g; \# cinstalled on a computer and to locate its installation directory.
3 I% Q' |: _- {% d9 l. KIt is used by few softs which access the following registry keys (usually #2) :4 O7 [7 z5 j! s- r1 q

+ Y. b$ T1 l! C7 a. y-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% ?) y: Z* f7 L: Z/ o8 [
\Uninstall\SoftICE
+ H$ C9 x+ A3 N% e+ R3 F-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 b4 c% u+ L$ U8 y2 K
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 {; G- H+ r  j. l; \3 Y
\App Paths\Loader32.Exe
; g: f6 U( S8 j) O6 v. \0 Q& E. `4 \( V; v: @! t3 ]
1 |* ?, ~9 X- z7 y
Note that some nasty apps could then erase all files from SoftICE directory( j7 J, \0 X% z1 ~4 d/ {8 ^+ Y
(I faced that once :-(9 L) W- T" a6 @) h/ X8 T- w0 o
3 V6 b/ \( |5 L2 G; w8 d
Useful breakpoint to detect it:
+ ~5 C/ m6 M. p4 p2 k* z; t, j$ k1 U: j0 f: B( `' C
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- U) o3 g, `: n" v; W( G

) Q" K& y7 D, N' m9 W4 R; I% T__________________________________________________________________________6 x  n, q5 H1 o" [# A- Z4 J# Z

* j! X" n/ q3 Y& D7 g! d! n) W, ~" y. j8 o! |1 z+ }
Method 14
" a1 w" O9 P* S; W4 Z( `: D=========
% z% I" ]" h( w- t4 x& B5 s+ Z' y" @' B' F' i3 g9 T/ k0 z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- C1 {/ u9 F, Q9 j; a+ T( Z$ W9 a
is to determines whether a debugger is running on your system (ring0 only).: k& z; _* ?6 u- ?+ `( W& Y! I

% B# w2 Q( [; N& v   VMMCall Test_Debug_Installed: h- z- i% c5 Q8 g0 C/ O* n$ j
   je      not_installed: f8 v" j. V% G4 G9 I( m% x! q
4 R% B$ ?$ U/ B5 H- S5 p( H: v
This service just checks a flag.
. m  T. i; h3 N, `</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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