About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>4 i# ]. A. ~+ u. E- U: t' l
<TBODY>
3 Y; \1 z+ f+ R7 x/ S, p0 O9 M<TR>
; C8 n5 x& c3 @7 [8 Q! ^<TD><PRE>Method 01 , W4 R$ J: E! x4 S3 C0 t4 G
=========
( _% e% U$ m/ U. y2 _1 g( h2 _% I! V) v( J
This method of detection of SoftICE (as well as the following one) is) C8 Q& L' z, P& y2 V5 B( g
used by the majority of packers/encryptors found on Internet.* T. F) I3 f" @
It seeks the signature of BoundsChecker in SoftICE
5 r" U& n/ s) S/ _, j/ \3 q$ v, Q
    mov     ebp, 04243484Bh        ; 'BCHK'9 R! I% @0 U* M) T7 l4 O! D  E+ q
    mov     ax, 04h. P$ B: G1 k! D
    int     3       7 u- ^! L+ y9 p# g
    cmp     al,4
4 |% }  F5 x# ?6 M3 y0 o    jnz     SoftICE_Detected
. o6 m7 \) G4 [7 o9 ]2 n' X% A
, v3 o5 n# {3 Z) Z1 F! J___________________________________________________________________________
2 Z3 u( j0 @/ N! o) y0 N; P4 Z" S6 s  ?5 X
Method 02
/ s, d; V( d' O. g: T8 f& ^; }  Y( k=========
4 N( p9 q! [, o; S: D' v: b/ W7 h/ ]5 u0 J- Z! t) X# ?8 L
Still a method very much used (perhaps the most frequent one).  It is used
% a( J" c7 y$ ^' n+ i  H# O' Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,7 Q& m# r5 i. p0 L) j8 M5 ^
or execute SoftICE commands...3 M1 \0 ~5 Z  B" G' [2 K  z6 d
It is also used to crash SoftICE and to force it to execute any commands+ w" w6 l2 g# A
(HBOOT...) :-((    _1 g! k% G5 Z$ V8 Q

- S% z! N: \5 [Here is a quick description:
# q; |- C' n6 @, Z2 f-AX = 0910h   (Display string in SIce windows)0 M' k1 P8 X7 ^  v% @7 }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): i6 {  W0 _+ G# T1 \) h( @. i$ Z& J
-AX = 0912h   (Get breakpoint infos)
4 _* }: g( G" ?1 B4 ^, S/ `, |, s-AX = 0913h   (Set Sice breakpoints)
. v- N: M8 }/ g( f9 D-AX = 0914h   (Remove SIce breakoints)6 |+ a6 Z, r3 i  H8 H( n4 y9 V, ^

. E. h, q6 J2 H2 P/ w& N% _Each time you'll meet this trick, you'll see:
9 B/ \, B0 r! g7 B  @6 G; f-SI = 4647h- l  B+ v- L( V; I0 Y* L: U# ?* V0 a1 ^
-DI = 4A4Dh
& h6 h, Z% N8 n9 NWhich are the 'magic values' used by SoftIce.6 w9 [$ {' Q% G$ I7 p0 {9 u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% p+ o) a1 i' f9 N
1 g$ c: \. i, O
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# d3 C/ w4 M9 U  |5 V" mEnvelope utility use to protect DOS applications:% O8 m7 I" v* h. C6 A( H* q4 o

" q4 W; @! F4 w6 x( v* p
8 j3 Q) I. o/ S" x6 l4C19:0095   MOV    AX,0911  ; execute command.& @8 y2 ?9 W! }# l7 Y+ r+ l
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 k& N0 [5 }& ?& J) D
4C19:009A   MOV    SI,4647  ; 1st magic value.
+ g- j) A  S( x! }" l1 I8 S) T1 o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  a- K  v0 E$ c+ f1 S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 Z5 w, y* P# D5 r1 X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 `: z) z! m( Q, R: q# F8 N8 r
4C19:00A4   INC    CX
  ?, s- v$ h$ K7 b9 n( [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  m: h( s( [! }: t- P4C19:00A8   JB     0095     ; 6 different commands.
' }$ J( P2 a6 ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: V4 S! h0 o% j4 l! k: Z" ]. a( K
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 I6 T2 {' x. ?% O8 _4 c
) z& J3 I2 K+ Q% Q
The program will execute 6 different SIce commands located at ds:dx, which
  G. Y( R! `+ S; Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- ~, i& f! V- y4 p4 g! J# I' w" j
; b  L4 X+ K: x8 o
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
. F4 X: [- y: _8 h5 \___________________________________________________________________________7 }/ D& [7 k+ ^$ O# @7 w

, v; R2 b; D$ h- {9 C, a6 l
" ?! I$ _: Z9 M: oMethod 03
$ W/ {- ~9 I9 h" h=========6 |5 |! Y& m: t* M5 @
5 {5 w% S+ ?0 B3 s$ y# U8 M
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h3 g+ N3 f3 R, J) a. F
(API Get entry point)
! d* y+ X: t7 @        3 z, B% |' Q. V3 t* Y

+ o& f3 Y0 S. Z' |    xor     di,di" k9 k  w  K/ K( n3 E& u7 |
    mov     es,di
* D3 C% }( H8 W5 \    mov     ax, 1684h       " \& e  n. v6 }9 {0 v
    mov     bx, 0202h       ; VxD ID of winice; f; }+ M- l; B1 p3 e* G
    int     2Fh
% S; b- R: e5 P4 s% x# M' z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 r9 Q& Q. j. i9 q+ w/ R    add     ax, di
2 F" X  A6 I  f  d$ L    test    ax,ax7 U5 \/ [" n0 B* E( X/ P, S  l
    jnz     SoftICE_Detected/ Q. k5 I; S7 `. [) |% }) J

/ V( T2 w7 z( R: B; [___________________________________________________________________________+ p3 n, D$ Z& h% P1 y1 h; ]

, T8 O+ s# x! @4 U+ S" K& }3 XMethod 04) n1 b, t( \  e0 I
=========
4 Y# d- e& v: G9 G* |/ o4 L, m+ N2 }6 b7 D
Method identical to the preceding one except that it seeks the ID of SoftICE
5 w' S/ a8 o3 SGFX VxD.1 L% {0 F$ s) G  I
8 p+ w3 ]6 f! I" I" {" ]( i
    xor     di,di
% P7 k4 y6 R, m    mov     es,di
3 G. K1 C: m7 a4 ~    mov     ax, 1684h      
. D& n" M0 M# T' v; H1 s4 D4 f0 W    mov     bx, 7a5Fh       ; VxD ID of SIWVID! V, Y% y$ B( e% m$ f9 }4 ~5 _8 z6 E
    int     2fh: |, Q) O, Y( B7 |$ y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 F" x) o" c  U6 S    add     ax, di
* |5 ]0 T, @1 B9 D    test    ax,ax
, s* h; I) T  b& ~8 |2 E    jnz     SoftICE_Detected( j1 f# c- I+ M1 ~* B. J' r
( H; x: J) e( E* a/ R- Y9 h* I0 r
__________________________________________________________________________7 g- B. Q& p; Y5 X( b# a
2 P: _/ B) B$ w0 u& H
% V0 Z6 W' i% ]  w" y
Method 05
1 `2 h; ?+ o6 ?. j5 p/ ~=========7 q6 Z8 S$ x% ~8 C% s) u- O% C
5 ?+ W$ B& |; J+ s# p, {5 Q
Method seeking the 'magic number' 0F386h returned (in ax) by all system$ m9 q" O) P& Z* q! m# L
debugger. It calls the int 41h, function 4Fh.
3 U5 o" B* R6 D1 xThere are several alternatives.  
8 L4 Z6 |3 i8 @1 u$ J
% S. ?) ^$ Y1 o2 Z* h2 RThe following one is the simplest:
0 X# d( [) f5 L, Z- B* e2 g" }5 O$ ^4 m( m: q; X
    mov     ax,4fh
3 z! ^1 a) u7 f. I+ |" P) y    int     41h2 e. B' U" M; F+ k4 Q, r7 O
    cmp     ax, 0F3868 p& m* ~! ?  G
    jz      SoftICE_detected
% l5 \$ W- M/ b7 v# Z' a- Y$ O3 D' i* F
9 f& Q( f) G2 M4 A; S6 i- `) \- `
Next method as well as the following one are 2 examples from Stone's & R2 L5 f, n2 z* e; o# i' L/ U
"stn-wid.zip" (www.cracking.net):0 X3 x1 l- M5 U
+ ~9 ]  f- t1 y1 w
    mov     bx, cs
' P% ^1 H+ L' }  v7 N% g    lea     dx, int41handler2
) Q( X/ [: U5 Q- P9 J    xchg    dx, es:[41h*4]0 |5 k; N& I3 v2 X+ }6 G
    xchg    bx, es:[41h*4+2]- {) X. n8 R  g0 J, s5 L1 J
    mov     ax,4fh. |. r$ @" }) x7 h* V
    int     41h
" b$ G1 U6 K2 s; ?    xchg    dx, es:[41h*4]
5 N0 Q, q6 q; b& j( g4 B    xchg    bx, es:[41h*4+2]
2 n. s# `* [+ T& t/ p; I3 e. b# w, Y    cmp     ax, 0f386h5 w/ u# v6 X7 \# d
    jz      SoftICE_detected
1 `3 t. H0 n1 @! B( N0 L6 N/ O0 M6 C
int41handler2 PROC+ f* U; c7 U" n1 s# x0 N
    iret: w4 T( {& n* v, M9 e% s: Y9 _! B& W
int41handler2 ENDP
- h. V5 q& b( w* j2 J4 R% a0 d% X1 x" h9 ]" [: v5 e
3 @1 e6 C& p* V
_________________________________________________________________________- c% l# I- x+ d7 q  k

9 K0 t: T+ q8 o  K+ C0 u
/ q5 D6 b4 S7 ^4 g; F/ E& m1 ^Method 06& X; v, ?- Z; ^5 l3 S
=========
1 a. S- P; q3 N# j
! m8 R* {" E* v9 f) P3 |- }) ~1 |5 T
2nd method similar to the preceding one but more difficult to detect:
9 M; S% s) {& @( F* q9 i7 L0 n& i1 k$ s! ?

6 C8 p/ m- S: S+ b, E( C. Qint41handler PROC; C5 ]# n; L( H' E" u0 E- L
    mov     cl,al6 Q  c2 P3 ~4 x; }) p- h
    iret$ q  t1 q6 q1 |! }9 R# a1 e
int41handler ENDP; s0 |% L  T; V

6 o! _( q( J) Z* e9 q/ y$ Q' b* r: V7 p- `! {
    xor     ax,ax
, ]1 b. f! @. ~# Y9 z    mov     es,ax
2 c4 Q/ f9 c; V: A6 C) |3 E# x( Z# m  u: ?    mov     bx, cs6 z+ ]0 _( ^, r3 U6 @+ U
    lea     dx, int41handler
' v9 b$ H5 a/ h    xchg    dx, es:[41h*4]/ ?+ n! I; _' ~, G: }# l, R
    xchg    bx, es:[41h*4+2]3 G$ y4 y5 e( l5 ?$ Z
    in      al, 40h
9 \9 l: N. k4 z2 S4 w* g    xor     cx,cx" o, m' Q+ I* E, }* Y
    int     41h
4 w! K6 P, o8 d( L: i    xchg    dx, es:[41h*4]4 b/ a- D* J+ B6 K) n$ e/ T
    xchg    bx, es:[41h*4+2]# u& d0 U  H. C( t( k4 l. F& W
    cmp     cl,al
+ V6 m% i1 A# f  t    jnz     SoftICE_detected4 d  z  x+ `# D

& l4 h4 S) E" @/ K' \) N! C_________________________________________________________________________) Z+ G- ^7 e2 h. n  c, R
! d7 R7 D$ M: N7 e% ]
Method 07+ }4 w3 Y; n- m) s- K9 ]: s( U! M0 W
=========% K2 |" C. z6 T& Y0 e3 j4 T  f) s

- {8 O1 a. p/ q; \Method of detection of the WinICE handler in the int68h (V86)1 r" u7 S/ t+ m; [8 x8 T6 g
: _1 `# a% e2 x
    mov     ah,43h
! W2 t2 Q. M. e) p    int     68h2 S) ?  q5 ^4 t# i' \! V' p3 g$ w
    cmp     ax,0F386h
- a- S4 O8 R5 h. d2 }& e# i6 Q$ _' \# v# o    jz      SoftICE_Detected
% {& g4 s( n' @8 b( n; ]& X4 o# q0 Q9 Z3 t# u. F
* T  z6 |! N7 m! m
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit: _# z9 d" j9 f
   app like this:
* i# C& B9 Z6 d1 k9 J- o) A8 j0 v; e
   BPX exec_int if ax==68
( J' B: N0 b: E: n# i) ^- ]2 Z! E   (function called is located at byte ptr [ebp+1Dh] and client eip is
; j2 G/ |4 X# h, G$ x- I" }   located at [ebp+48h] for 32Bit apps)
( J- ^( E; W7 D2 k4 D: Z# s& V) C__________________________________________________________________________) `' ~% y3 t7 w7 S# n. K
* a5 p, t# S2 u, d

! R- R' [) D/ c& j" W( ^Method 08
" Y* O. G1 e2 I3 ?/ c- K0 ~, L=========/ `! [' j# k8 A
7 y) A: g+ p) M
It is not a method of detection of SoftICE but a possibility to crash the  s+ X- b& o5 Z1 M% C- S1 T
system by intercepting int 01h and int 03h and redirecting them to another
5 j) ~$ ]6 f" E4 V5 T7 Broutine.8 d) Q) N, j8 G0 E4 d# l, z1 S% e5 v
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 ~) r9 G& `1 o2 m
to the new routine to execute (hangs computer...)0 G: ?9 q4 M# P

* F$ n, M$ M% c0 F# _/ _. T    mov     ah, 25h
' L9 B* M9 n8 u: {    mov     al, Int_Number (01h or 03h)
3 |, n( w# Y7 Y/ \6 ]+ D    mov     dx, offset New_Int_Routine
3 G3 D9 V) J6 H  M# ~; v9 l    int     21h
4 \5 t$ t( U' U' B% v4 O6 C2 s$ A& _, d5 D
__________________________________________________________________________! \  ~! i- ?0 m% D) ?
! G4 D. }' V! d& s: c
Method 09
! C1 k, r  b/ I+ A; E- L=========
- E$ D. |# y5 d/ B9 O; B+ n: k/ A4 i+ E
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 O5 C9 l/ Q3 ^performed in ring0 (VxD or a ring3 app using the VxdCall).
1 t" T) \2 u  @: h' h: tThe Get_DDB service is used to determine whether or not a VxD is installed
9 l$ |# i) D  i6 b% t7 Z( S# Afor the specified device and returns a Device Description Block (in ecx) for
2 M, |" e1 Y! [' u8 V7 u% K2 Lthat device if it is installed.% o; j8 E) p9 L* r

  g) ], E$ |. @- h  ?   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- X# f# A* `; Y7 _- z  U4 |+ c
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 R( u: i5 m' {" l+ w$ [
   VMMCall Get_DDB% l. {- w% a7 B  @6 H- `; y" {& U
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  j: a4 y% j; w4 b. h' V
' h; E  G7 y- S- b$ R
Note as well that you can easily detect this method with SoftICE:) Z" `- ^- w" r; n
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 E8 q, \) H! m3 s: A; d7 Z; L- W( {0 `/ a) \
__________________________________________________________________________
" j+ Q9 C4 g( t4 t
' d! B. u9 t0 l9 |5 m# r5 JMethod 10; {  f$ @  x% w8 J
=========
: G% x0 ~+ {0 n' X- z) q4 {; r. r4 b+ Y8 O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% ~* _* ?1 c2 M8 ~# i7 T, I  k
  SoftICE while the option is enable!!
1 e9 O6 f: |, z4 t' X9 r- x8 l6 F2 B/ y# L
This trick is very efficient:7 `" s- F7 S+ L7 Q
by checking the Debug Registers, you can detect if SoftICE is loaded
5 f7 @4 a( Q: s8 I(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. }) P2 |4 r4 I. u. H; pthere are some memory breakpoints set (dr0 to dr3) simply by reading their/ r9 W  Z% y9 L5 u: ~
value (in ring0 only). Values can be manipulated and or changed as well% ^* b1 e% c) N) L3 \/ v% b
(clearing BPMs for instance)+ E) e( T4 {5 b- ?" l
- G8 p& S6 M: D9 w
__________________________________________________________________________, d- d* u4 ~! n

- ?5 Y1 |8 i& x" V5 A# IMethod 119 E) k3 q# \0 p; e  e3 q
=========; W) \: {' W  H# V2 k+ d4 G- G
' u1 Q0 u+ J1 P5 l
This method is most known as 'MeltICE' because it has been freely distributed
/ t, ]  U- ?* S2 jvia www.winfiles.com. However it was first used by NuMega people to allow& `5 d1 i0 a; g3 w7 b( p
Symbol Loader to check if SoftICE was active or not (the code is located
% ~  c: h+ H8 winside nmtrans.dll).
) c6 n, ^# G9 t+ k0 ]' l
8 Z$ W( o9 `' N9 A1 S1 V( G* MThe way it works is very simple:/ N" d/ W2 l2 ?1 c* X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 L2 i/ b, M7 P6 c' |
WinNT) with the CreateFileA API.0 Q* v0 m5 s3 ]3 o- ]

' m! U6 n9 |1 J5 Y8 QHere is a sample (checking for 'SICE'):
- C& D% G1 t8 J
2 k, z5 e# E9 R3 i' oBOOL IsSoftIce95Loaded()) f9 x) \/ j, `1 F
{6 b* I8 }8 j! T* ^
   HANDLE hFile;  
. Q; o5 u7 f9 B4 Y  P0 B; h- K   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' I* I! I3 t7 d' H
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ H! h; f  i/ r2 z6 s. S9 s+ r
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 f: E% m* u5 o" e# L1 p
   if( hFile != INVALID_HANDLE_VALUE )6 w& _9 E- m: R, X0 j) U
   {
/ u+ N$ ?+ ~8 Z7 n% a+ M/ g9 h      CloseHandle(hFile);
1 \; R* B9 K5 q6 o" C, W- c      return TRUE;9 @& B& ?1 ?# c. G7 \* c; ~
   }
, D1 D) s/ |& O8 y( _   return FALSE;
2 o2 a; |( t! G9 B}. O1 P1 Z  E/ H* x
+ N6 H8 e( n. A2 H% c; R- J( [
Although this trick calls the CreateFileA function, don't even expect to be  c5 z2 R, G9 s4 A8 C
able to intercept it by installing a IFS hook: it will not work, no way!- y3 ~+ G& g' R7 ^, A: _6 U
In fact, after the call to CreateFileA it will get through VWIN32 0x001F$ @5 g% k' i3 l& [- O" s$ Y$ u, i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( J7 d- Z* e/ J2 wand then browse the DDB list until it find the VxD and its DDB_Control_Proc
: u0 G1 K, ~; Ifield.
  i# d9 ~% K$ d# j. E- IIn fact, its purpose is not to load/unload VxDs but only to send a ' I' J; W1 x. a; o
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ p" R  b! H0 F5 A3 I1 l4 x
to the VxD Control_Dispatch proc (how the hell a shareware soft could try0 x+ o8 f. v$ p8 [  L) m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
  J6 F, b* Y. v+ z- P' W& mIf the VxD is loaded, it will always clear eax and the Carry flag to allow+ v: N1 G0 H' \. V
its handle to be opened and then, will be detected.
) h$ M' {% Z1 }$ P) b- o5 VYou can check that simply by hooking Winice.exe control proc entry point
/ h" U- \/ r5 Z, P0 Bwhile running MeltICE.* g1 F$ ?1 _% _6 Y8 \# }! w* ]0 p
$ j" ~: Y; @: ]1 _* h# H! y

: V6 i) I# N& N  U  00401067:  push      00402025    ; \\.\SICE
8 v; z' i. j, A$ A2 v" l; o  0040106C:  call      CreateFileA
; j2 J: ?0 S! R  00401071:  cmp       eax,-001
0 V% \( y2 Q) V8 h  00401074:  je        00401091# f" M% b/ J0 F# U$ d. j3 D$ Z5 @
9 U$ g+ a4 x3 W, T' S

' m5 S5 z7 E1 x2 t) xThere could be hundreds of BPX you could use to detect this trick.
# \, v! W) i9 }. e0 e7 o-The most classical one is:3 _4 @6 t4 m; M; F3 \0 V, X* [$ R& G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 l& n' j3 c, y
    *(esp-&gt;4+4)=='NTIC'
* T6 P1 L8 n$ f) r' h1 \& U. Y5 N1 z& c, w+ Z8 i
-The most exotic ones (could be very slooooow :-(" A/ p; Z1 S& L. V  K# |5 j% a
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 `( B+ X# E* ?. ]% J, r- @
     ;will break 3 times :-(  b: R# w* D* c& ]: j( h* v
" ^( Y; c: ]7 D, M9 U
-or (a bit) faster: * G2 A! F, T0 Z* a5 F
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; G, `4 k# X, i7 S( v& N7 {( q, C; f% {5 [7 B' c$ o2 k
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* s- G5 P5 L) x3 o! k     ;will break 3 times :-(# h8 |$ M, v  b" W. J
7 t8 t8 |1 ^) x+ u+ l. T3 A
-Much faster:
$ ?) Z! V1 s/ T6 R   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 e) U' j' M! F7 a& O
, F/ X+ V" f8 ^3 z  ^; c4 y
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 x9 C- w/ U4 S6 ?  p1 Bfunction to do the same job:# [* C7 U) f8 k/ Y% Y4 L# q
  p5 m4 m  w8 [7 d, k' s' {
   push    00                        ; OF_READ, O5 ^' q, P$ A5 h. Z7 t7 ?
   mov     eax,[00656634]            ; '\\.\SICE',0
9 G9 S2 ?6 i# m. S( h( D5 I   push    eax- g: q; q. Q* X( P- c: l: T
   call    KERNEL32!_lopen
0 q; Z# V1 |: V- n3 W   inc     eax) h! U' F! d: b6 O+ ^
   jnz     00650589                  ; detected
5 a. L' V3 [& h   push    00                        ; OF_READ. O# ], m+ x) c5 F1 P5 \& M
   mov     eax,[00656638]            ; '\\.\SICE'- O1 S+ t9 @  a
   push    eax
+ L4 L3 N: E, E' B* g4 r( }   call    KERNEL32!_lopen
. W6 |- y0 Y) X4 c# S% j   inc     eax
. K4 i3 N6 e. t% S2 a$ Z/ e   jz      006505ae                  ; not detected
' A3 b. u" g7 }1 ]) W+ L% _( D. Q7 k6 {  G3 y9 T: |+ T
1 G  U* L( R& @! z9 C2 U0 \
__________________________________________________________________________
" z; ]) J' D- _2 t* m2 }; l
1 N# d$ k- x) N  t+ c' KMethod 12
6 q1 ]3 W1 l4 D8 Y=========% m5 d3 ^' I6 B+ v- P

8 r+ z# i# `' l$ n# ]. K8 m0 lThis trick is similar to int41h/4fh Debugger installation check (code 05
( r1 b6 G8 D9 F1 s. F1 R: [' ?6 e9 ^+ Q&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( a5 i. N# m- k  M: I& V7 R* fas it uses the VxDCall backdoor. This detection was found in Bleem Demo.& b! A5 U1 f9 Q' z5 N1 c7 y

: \0 L5 A( P# g- ~4 n4 p( }, S   push  0000004fh         ; function 4fh
3 l' n$ M% O- j/ o9 K) e' J" |   push  002a002ah         ; high word specifies which VxD (VWIN32)
! x8 w% }, c5 h5 C1 c                           ; low word specifies which service
, z! @% [  l. q2 o' g# x3 G, [& b                             (VWIN32_Int41Dispatch)
' p5 \$ c' m6 o, B1 Y$ h   call  Kernel32!ORD_001  ; VxdCall
0 G/ {8 G# i! u- G/ N* X* Q9 w0 E   cmp   ax, 0f386h        ; magic number returned by system debuggers3 y: k$ N! s7 }# e4 }9 h+ T
   jz    SoftICE_detected  V; Z7 h3 b. q) f6 c' g4 ~( M
- ?0 Q8 U( g; Y( L) Q- `. i$ e
Here again, several ways to detect it:
6 ?& j+ v* q0 \: C2 z6 T/ |, I* L/ d& D" y; M
    BPINT 41 if ax==4f
) Y7 S7 v  z4 a1 B! h- \4 ?" L
: C" k: R: X+ z7 W( M    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one' b+ A" {7 J/ j" r# B$ ~3 t% b

9 y+ }; x! P# f1 e+ ]8 e    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) Y9 K9 B' k! w  y$ q- H
5 I3 ?1 _( u. i) ~" {/ \$ \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 h1 s7 r7 X1 ]) J* e

8 V1 S* U* `% g- w6 I5 O__________________________________________________________________________: v$ v' b4 Y0 w7 i
, b1 Y& W( t2 y6 t9 F5 k
Method 136 B7 q" b! h  H4 X- `' H
=========3 C( M+ z1 I8 F7 ], K& O8 {& i( z' W4 A

: L  z# T9 p! u, y$ l, B5 {Not a real method of detection, but a good way to know if SoftICE is
* E1 R, X4 o3 f* ~installed on a computer and to locate its installation directory.2 V6 c6 j7 t( B+ q
It is used by few softs which access the following registry keys (usually #2) :
0 t4 r$ ]+ y  W% l$ n, M3 w3 Y. }5 m
5 K  V* A* V9 a5 P-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 E! O& o3 \- p9 L' r. T6 R7 C\Uninstall\SoftICE
9 y2 J$ L5 I! f7 A-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( Y3 e$ k2 i" A" t  G-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 J, r. W& k8 y
\App Paths\Loader32.Exe9 @1 n% f  F' T! I
, U/ g( B# Z9 Z& T0 Y" T2 A! Q/ `6 e
& C2 j# _% u# ~2 Z; G
Note that some nasty apps could then erase all files from SoftICE directory
: l+ Q* i# \8 E$ k" Y6 d9 J(I faced that once :-(
5 Q. p0 \2 g; v$ ^: F: w$ B" s% V; |$ x: d. b" I
Useful breakpoint to detect it:
8 z9 s) v3 [) L* ^! E4 v& t
. ~/ K4 S0 Z! k# o+ t) n8 W     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' ]4 F$ v' O5 F. m) F. b8 ~- y' K* r! _5 [
__________________________________________________________________________1 ?, Z+ f- A* C/ r
& A6 K! a4 X/ Y# V; t* F
" v2 p  V+ H; G5 r3 P. _
Method 14
$ n8 R, X5 r# T  ~$ X+ T) a=========
$ H! ^0 R0 ?: h! n) l
$ j. s( P& Y0 Z2 E5 qA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 v! s  ]- w- W/ Q. [
is to determines whether a debugger is running on your system (ring0 only).
- w; U6 k- w" c: b" U9 E- U
+ R0 k; l& G0 H, a) r4 S6 l  X   VMMCall Test_Debug_Installed
: {7 j  ?# `9 g5 z8 S, r! o   je      not_installed
5 y! X5 H, {* R  b7 N
* V0 [" N$ {/ z  H0 |) x2 DThis service just checks a flag./ ~* Z/ a! ^8 @
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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