About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 y' R& A0 K. I0 j0 D
<TBODY>2 y) S' u- X  d; F$ `% g9 B
<TR>
% `  w% [4 }& ?$ L* y<TD><PRE>Method 01 0 h( N5 u) }$ l1 h3 I. E7 m6 T
=========/ R0 K; f8 g4 w( a0 z4 |- ^

7 B% e  ^3 j/ y4 \2 H4 X2 J! Y" J3 WThis method of detection of SoftICE (as well as the following one) is4 j" _/ W# t& x: M% r
used by the majority of packers/encryptors found on Internet.* R! n- T, L0 V0 T3 Q
It seeks the signature of BoundsChecker in SoftICE6 X2 W9 K5 P# s; |) B
0 u$ L0 h0 W9 H5 C! H/ t! S5 M
    mov     ebp, 04243484Bh        ; 'BCHK'
! A$ c9 k- P' A    mov     ax, 04h
: h, v( A6 y+ ~. j, z$ ^    int     3       7 h3 {4 C9 ^4 |$ t5 `: n2 R
    cmp     al,4
2 H: G9 V: J7 H; j: j    jnz     SoftICE_Detected
+ Q) ^) x9 ~' r" q9 D1 n  N$ S! r9 S; }* }2 E
___________________________________________________________________________7 H4 q( w' C- P2 x( Z1 f& q

+ h, v+ F9 ~/ H4 z3 F' y/ [* |, gMethod 02
0 o4 D6 l1 G" L=========
# j: D3 }) Z9 S9 W( O; p
* K* x# ~8 K; G! y' rStill a method very much used (perhaps the most frequent one).  It is used7 R4 {/ B  ]% z0 w4 G% J
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 O/ J" Z7 D' c. R/ s
or execute SoftICE commands...
5 O4 q" l* L3 ^It is also used to crash SoftICE and to force it to execute any commands; A7 K' i1 }. q
(HBOOT...) :-((  * q! z0 \. A2 u! `* P

" ]8 l  x3 k6 k$ C% G7 ^5 |Here is a quick description:
3 s& F; T9 m0 O-AX = 0910h   (Display string in SIce windows)- O9 o* i% c/ Q$ p" i- X8 T: d/ h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( {2 z! m" B+ y; I5 S/ E-AX = 0912h   (Get breakpoint infos), u6 y9 P" q' e
-AX = 0913h   (Set Sice breakpoints)
& t+ m2 l. e1 q* v4 J0 O-AX = 0914h   (Remove SIce breakoints)
5 r7 a6 W: z- W" X0 r8 U5 D# q2 |' X1 \* p& b
Each time you'll meet this trick, you'll see:; [& }( I$ x9 m6 p( f
-SI = 4647h
9 ^3 B5 a( k# w$ t9 j: O-DI = 4A4Dh
8 J9 j# g! G& O4 x( Y8 e4 SWhich are the 'magic values' used by SoftIce.
/ ]% E$ \' ]( S5 CFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.' [  O0 L5 c$ Q* D8 d, d9 P

# A1 g- Q. F& ]# R: YHere is one example from the file "Haspinst.exe" which is the dongle HASP% T& h. v) T1 D
Envelope utility use to protect DOS applications:) ?1 J6 C4 V4 r; D4 x8 [

9 T, ]" d( i( g7 z9 O  x) A
% ]2 {8 Y, ^- F# p6 w5 V4C19:0095   MOV    AX,0911  ; execute command.. Z2 y- e; |- v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, @; x4 P4 Q& X9 c5 l% ^" m& u# T4C19:009A   MOV    SI,4647  ; 1st magic value.& U; N9 v# S* y4 e
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 g) o0 _: u1 _% b
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 Y$ c: N  M7 g" G7 L1 M+ Z# }
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* B# ]' X: A* |; g% v' O' |7 d# ~4C19:00A4   INC    CX
, y- a4 F) s6 F$ C' J  C" r4 F9 r! C5 D4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) q3 E9 K$ V) S/ o! ?
4C19:00A8   JB     0095     ; 6 different commands.
7 J; [0 v/ v& u" F& w3 o# \5 u% M; {4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 [. ^0 R3 i  d, k9 C4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
; x; q- r: _4 ?/ S1 c* i8 Y7 P0 r: J% P8 t3 \+ n
The program will execute 6 different SIce commands located at ds:dx, which$ s; v7 g& U8 o' o" a0 [; c
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 j% L1 W# @. O& u. t( _
& s+ K, L3 i, ]7 W- v. E: ~, y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 C2 l! u, ]8 I/ k/ z___________________________________________________________________________
! a+ J* J( Q4 k) Z
4 U' }3 `4 V; @, i' G' }0 g
5 p9 W1 s  l0 ]Method 03, L7 c$ K4 r5 }, i1 G; P
=========
8 B) j: ~, W9 E1 P' z+ g* E9 {2 ]' u" u: T! a) b7 c: w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ N$ U4 S9 a! ^$ T3 f. P6 ?3 E3 U& l(API Get entry point)
6 F  ?% r! m4 G, f' Q' Z        % O/ M6 E0 u( q7 `

$ F$ v3 h$ c4 k- R    xor     di,di2 r# j2 Y9 V9 x: J$ ?
    mov     es,di
1 C' C" ^: Y8 G; \+ }- R. ?    mov     ax, 1684h      
( B" U1 @2 Y" M) |    mov     bx, 0202h       ; VxD ID of winice  K- h3 J$ M1 j+ L0 G. t& R
    int     2Fh
1 E! H' d0 v  T( ~' ~. D) `5 h: F8 n    mov     ax, es          ; ES:DI -&gt; VxD API entry point* y+ Q) L& x+ W2 H$ v& J; m
    add     ax, di. w1 g% Y' s- K$ o8 S  w' F
    test    ax,ax' i5 q, g* B5 @! j. Z
    jnz     SoftICE_Detected, @. S5 d6 m. t3 S7 L
( C4 a4 a3 U9 O  D4 u% `4 l
___________________________________________________________________________
% I2 m! y% N2 E0 q
, [/ d! [4 u- I5 [3 ?2 k2 s- i+ sMethod 04
7 A; }2 D5 m2 H& O/ N=========  d* g) Z. r* }* E. {5 y- C2 Q

" h1 Z, ~/ e5 S' Q; H! j+ O2 h8 qMethod identical to the preceding one except that it seeks the ID of SoftICE! F# N; [2 C4 E
GFX VxD.. r( T9 e8 x" ^0 {& H' d; D( L: @% v; ^

$ h$ J% z) Z* `" ^    xor     di,di$ Z  U! V  V# m5 }/ t, b
    mov     es,di
5 s/ W5 N4 i! o5 n* b% l    mov     ax, 1684h       4 y, G* N0 ?" N- w8 ]& X3 `1 ~
    mov     bx, 7a5Fh       ; VxD ID of SIWVID+ j; l7 C* _4 b: x2 s5 n2 L! f
    int     2fh
6 F5 {; X$ q$ B. C" z9 O+ D1 T    mov     ax, es          ; ES:DI -&gt; VxD API entry point- E6 C4 i! ?" C; X+ S3 _6 {/ C4 C
    add     ax, di
+ M/ p0 l; r  E: x    test    ax,ax
* E1 s" K& x1 |$ }+ b0 B    jnz     SoftICE_Detected, o8 r3 H! g! k; s- D6 D7 S" V  y

: T* }$ e8 {/ i8 V__________________________________________________________________________
4 h3 G  Y1 \2 Y+ J0 t$ {3 B9 r0 |* P0 u, D. l: r  L) Q1 Y
2 E% |; O5 H' O" b0 f3 M* a1 x0 m
Method 05
: m) F) f2 n$ H  ^# E0 K=========) g0 X; ~5 I0 E/ `) ?6 s

4 h( ^" f5 T. ~( w- DMethod seeking the 'magic number' 0F386h returned (in ax) by all system
  C# t! M$ l8 _4 Y9 A- m2 ^debugger. It calls the int 41h, function 4Fh.
1 R8 k% m, c( `/ NThere are several alternatives.  
" g3 j( z& L: U4 E+ p* q9 _
0 k; _1 E+ ~6 \/ v2 Q0 d* ~9 _1 {4 AThe following one is the simplest:2 h8 _8 a: \2 N; g7 I

3 }4 P7 T: d. F. _# I, L' S- h- f    mov     ax,4fh
4 c9 l3 U% |( l7 \7 N    int     41h3 C" A. [2 k) S
    cmp     ax, 0F386
7 ]' r: \- s- U$ @: z6 Q6 j    jz      SoftICE_detected
) J* G2 V/ ^% ?$ @- ]+ h. d# R" v; U5 `! D) }- F2 t: ^: x
8 b. Z3 E5 R: \; I" `, m6 w
Next method as well as the following one are 2 examples from Stone's 7 C/ ]3 l6 [$ ?) b2 |
"stn-wid.zip" (www.cracking.net):0 m3 v# g. t% c

6 j8 {1 a) ]4 E+ z: S. o    mov     bx, cs
' D+ n3 V& V% R    lea     dx, int41handler2
9 M, u- A4 }$ @; g    xchg    dx, es:[41h*4]0 n) V: U, L$ Y9 j  X5 x- ]
    xchg    bx, es:[41h*4+2]
; D2 [& s. w, _  K) K    mov     ax,4fh
* F0 `$ _/ {( T    int     41h- g% {) u, o2 e" _8 g2 a
    xchg    dx, es:[41h*4]0 q) a" p: F. `* b6 N' a
    xchg    bx, es:[41h*4+2]
& T4 r7 O4 @' s7 Q0 U3 v9 s    cmp     ax, 0f386h! o. v/ M/ c  a1 O4 S
    jz      SoftICE_detected5 z3 |/ g3 J8 M% n- t5 u9 U

5 W6 |: }! Z  }) Uint41handler2 PROC; j$ U3 q: S& m4 Z6 }; R  a' A
    iret7 R) h* q5 p" H8 F# f
int41handler2 ENDP/ J) r6 E0 j) \8 l
3 S2 G1 [0 F* ~
. x3 H# q: r6 ~
_________________________________________________________________________: i+ |/ v4 l" S. A( s% }: F0 u
3 @: k6 f* U: _$ @
6 y# l' f8 G) [0 E) a/ e+ T
Method 06/ n) S' q7 {' m* U7 E3 v
=========/ g( v* O& D9 K. ?1 R
% v4 q1 ^8 p/ ^' z) n4 V, C: Y, w! m
7 @. T( f6 I# d$ B) w( H- w
2nd method similar to the preceding one but more difficult to detect:
* a6 {: _- P1 J. r6 V1 ~# W. T+ W3 n, b5 m- h

9 b1 m& a  d, p1 J1 o$ Zint41handler PROC# D1 y9 s& X( N/ h! H+ a' J
    mov     cl,al+ |( E" S' i/ s  ], R- n0 t7 {
    iret
! p' G% c2 M1 Oint41handler ENDP
. M2 C$ F& j  Z3 Q6 w$ C1 ]5 L0 @: G, P% P1 S

  ?# ?* m. }6 t' g- t    xor     ax,ax
2 w4 u* z" P8 g" w  H    mov     es,ax  S- ?& p. S6 k
    mov     bx, cs
; O& g# X: J# O/ ~6 T1 a! u    lea     dx, int41handler1 B5 j3 |/ r, x( E1 }. t' _0 A
    xchg    dx, es:[41h*4]
% e5 i9 o# h& {    xchg    bx, es:[41h*4+2]: ?( H) N8 u+ ~- C
    in      al, 40h
! ^# R& V$ A/ a6 L4 M! x    xor     cx,cx
( z5 N# j! ~  f: M3 Q, b$ A! s    int     41h2 K6 d+ j! D3 _5 u1 g5 r) ^* ], S7 M
    xchg    dx, es:[41h*4]
/ N/ j5 N2 m  J* `6 ~, z# t    xchg    bx, es:[41h*4+2], R$ j# s  ?3 n" q6 H
    cmp     cl,al
5 _; x8 q+ ~4 g% G! C2 ?; m    jnz     SoftICE_detected/ }4 N; r/ g) ]; A
) S6 [8 T9 n% ~* T; ]& {
_________________________________________________________________________5 R. i7 Q6 B: Z; h# S! r, X
3 Z) V/ c1 K; V2 x  N
Method 07
1 u- _$ k  U1 j& U0 l+ D; G=========% I2 z0 F! z6 p% L' [4 s' I  f

6 d, ~$ f3 U# i# S, hMethod of detection of the WinICE handler in the int68h (V86)
) C- K. l& D2 ]9 P3 c1 |8 H
, f" w6 E! J; ^* ?  U' X    mov     ah,43h5 P# y- S% a% E$ j, i. {% G
    int     68h* n  F2 q# s8 w6 G( i& w% i/ r0 o1 v
    cmp     ax,0F386h9 x# s! @  ^9 U0 r
    jz      SoftICE_Detected
3 F6 H( H# c( n! r& i: E- L
6 t! I! J: C. K8 G# ]$ C3 w# s  R1 n: {: w/ G( u$ z3 {# U
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- f: P* b4 X1 j; x: F% S. O8 r4 B
   app like this:6 i1 f# z3 }/ A. [8 B$ Y1 e
  D8 b( M" a2 o4 F2 l1 G1 e
   BPX exec_int if ax==68
( D& l! x0 U5 I; F! s. a+ v: b2 p   (function called is located at byte ptr [ebp+1Dh] and client eip is
: I, L* G3 J1 K4 W0 ?' T) H   located at [ebp+48h] for 32Bit apps)
/ g  u/ Z3 B8 F" O__________________________________________________________________________8 @% ]( v( x+ }' `

* E4 r4 [! B& ~0 `. b
) n0 V; K* d/ n; e% cMethod 08
* Z* b4 X" g! E. k- d$ T6 w=========
9 _( u' y0 T! V2 [' G" V  ]5 s, C0 h! E
It is not a method of detection of SoftICE but a possibility to crash the
  U/ d2 |" _! V5 |0 _2 E( x& Psystem by intercepting int 01h and int 03h and redirecting them to another% a* ?7 v. Z& L; c6 E
routine.3 y/ A& v6 R5 k, \  J. ]. o  J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' J& M7 u, l8 A
to the new routine to execute (hangs computer...)
. ~8 I5 T8 L( \
2 w) o) }0 d3 J4 D+ V  {    mov     ah, 25h; \( r- \# O& p+ H# v1 u
    mov     al, Int_Number (01h or 03h)5 \) i1 r6 P8 D0 i) C
    mov     dx, offset New_Int_Routine- [- i# I% ]4 H. M
    int     21h
7 R: K" l6 o* v$ Q& g6 J5 R0 S' v( y  ?+ W
__________________________________________________________________________
) _& s3 [/ Q$ r5 z5 x4 {0 I3 L
& `# L8 ~6 \2 x4 X8 XMethod 09
; T, c8 F2 ~, q6 k) \, O=========
% R8 y2 h5 J/ E! g1 f! Q4 q9 Z6 L) U& r: F8 `! j
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 c8 _1 |! r4 L5 l2 lperformed in ring0 (VxD or a ring3 app using the VxdCall).
, R9 Q+ I0 P7 N1 \' ?The Get_DDB service is used to determine whether or not a VxD is installed6 c4 ]8 e: T+ F  M2 ^) N
for the specified device and returns a Device Description Block (in ecx) for
. [, T2 k, W1 A* E: athat device if it is installed.. }  ]0 r6 q) {& J: s% `; y

3 ]7 B  f& n% m# p7 n   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# e* h8 e" y6 L. Q3 Y) @% v   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), H: m- O$ F" c9 o6 k8 Q
   VMMCall Get_DDB  M3 W" J* q) A& \2 F/ a2 w* t
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 S  e5 m/ v: l9 v7 G7 D1 ]

3 q9 ^4 o# R6 ~Note as well that you can easily detect this method with SoftICE:0 V& g2 t. q  A  }. ~
   bpx Get_DDB if ax==0202 || ax==7a5fh* S5 C3 x  P' \2 A; S

3 `" G* {, W8 G4 A, F__________________________________________________________________________
4 S) X; l/ Y5 N2 g3 s4 u0 }8 x; e3 `* _
Method 10  z5 ?0 K! m. e+ w' w+ l' F/ R" N
=========8 [4 x% [3 G4 @4 g* L# }# {7 z

) E1 `' j/ S  ]3 ~% r# L( K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ w) ~1 A! ]8 @/ p1 ^  Y" Z5 @# Y
  SoftICE while the option is enable!!
% d' C- X) b7 ^3 P6 _' I9 F& t, C
9 b+ I/ w7 W* P1 C- YThis trick is very efficient:
" v) X' |# u1 z+ ~3 L! S/ xby checking the Debug Registers, you can detect if SoftICE is loaded1 C' d! M4 U+ V/ `8 Z/ s
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" x: o0 _" k+ v5 _! M0 w$ B
there are some memory breakpoints set (dr0 to dr3) simply by reading their
1 }& ^6 g$ n& Ovalue (in ring0 only). Values can be manipulated and or changed as well
9 Q& D- O  M; D5 X% Y(clearing BPMs for instance)! ?8 P8 i- _/ m  A$ v# E+ I  c
9 k; S6 i/ x5 g9 A1 Z) f4 `
__________________________________________________________________________$ t' L% s. b& n3 ]* h
# }# F/ X; p' I
Method 11
  U' a1 j: a8 G2 l( }4 s  {( e=========
. l. D' F9 Q/ B0 k7 W
  I7 A  M% c9 dThis method is most known as 'MeltICE' because it has been freely distributed
% K6 k$ Z# B0 f; i  Uvia www.winfiles.com. However it was first used by NuMega people to allow
# _4 t% O7 v, L- l5 x. y/ ?4 L' rSymbol Loader to check if SoftICE was active or not (the code is located
; T* l  x5 D3 |' `/ }7 binside nmtrans.dll).7 R, l4 E/ a0 \& W# M1 p' t
/ j3 k/ o( ^0 O) S- h
The way it works is very simple:  l6 S, K* P# V8 k& w' V; R% \9 \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, _7 v7 m! u. M9 o* w$ @WinNT) with the CreateFileA API.# a0 c; ?! i- r: |& M

7 z  d. C6 f( C$ j6 \$ p. `$ A, NHere is a sample (checking for 'SICE'):( b- w4 L& E/ p- H, G

2 S4 F3 E% d5 e$ |BOOL IsSoftIce95Loaded()$ p! g8 q  i! J0 {3 F
{
% T# W, ?3 ^& ~* k+ D0 O   HANDLE hFile;  
, g) l7 D8 R6 c+ m   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 x2 C) |! Q  g* t7 m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- P/ ?. ~) e8 T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# Y. c% [5 u6 V0 |
   if( hFile != INVALID_HANDLE_VALUE )  _4 y  w4 n5 P/ U3 E* S
   {
2 ?) l' N* F2 w3 O4 t      CloseHandle(hFile);. S, T) g+ o* T! d! |
      return TRUE;  I+ l+ _% F6 s
   }1 ~" U8 e% q" c1 Y
   return FALSE;
0 b+ T2 |! Q/ g}, o7 _( a# c8 E7 ^' y' D
6 e( w% B% U# K* _  R% q
Although this trick calls the CreateFileA function, don't even expect to be3 D: j0 W' }' p8 T  A! q- M" Z0 K  ]
able to intercept it by installing a IFS hook: it will not work, no way!; G. c, v9 D& r$ m0 p& `  b  G
In fact, after the call to CreateFileA it will get through VWIN32 0x001F+ [1 u0 L6 s+ u% y/ m& c6 L
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# t! A. Y- V2 j, Y% [; E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 `3 D+ u% x7 ?) N! c3 b8 o3 q
field.! y$ e& [0 u" _
In fact, its purpose is not to load/unload VxDs but only to send a $ _3 J( N9 R) U6 E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 m' s% D9 j5 U5 gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 J( K& n: p. Y3 U  _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 Q! G; {3 \: @' [  m6 L" sIf the VxD is loaded, it will always clear eax and the Carry flag to allow2 G2 J: k8 `0 i9 m9 B+ x
its handle to be opened and then, will be detected.; @- U; s3 b( @& T1 B* e  _# Y0 X
You can check that simply by hooking Winice.exe control proc entry point4 P" z2 w0 z: T# R/ C- C
while running MeltICE.
9 F: h, x/ O5 E  `7 N" j/ n; o5 ]6 K' P% J3 w7 T

! F+ l7 Z4 R) P  00401067:  push      00402025    ; \\.\SICE
: g! W- [7 N- q6 H: v7 x  0040106C:  call      CreateFileA
* q$ s% A* N# V9 Y: w; C  00401071:  cmp       eax,-001' C4 r9 n1 g6 B
  00401074:  je        00401091
2 U" \( {" C% t$ m; O" z6 g. f# ]& B/ p8 V
0 }% `4 y8 s. l$ p
There could be hundreds of BPX you could use to detect this trick.
5 c- q2 |7 Z: Z-The most classical one is:+ l3 L+ O! _& t9 ]% }& g5 b
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 N' g. t6 |6 r6 ~' B
    *(esp-&gt;4+4)=='NTIC'
) E9 v2 Z* I4 J
. D: M9 i5 b5 f* }-The most exotic ones (could be very slooooow :-(
) G: w" P' q2 d% m( o   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  # }, B+ m+ q  m6 `: ^3 w; K
     ;will break 3 times :-(
+ F% y6 |6 i7 [, U" w
$ [; V0 K6 @0 W9 |+ s: C# h# s-or (a bit) faster: * z4 o5 x! ~' r5 C: Q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 x7 D1 T$ R: @9 j8 @$ T( B9 G5 G  }! E% Z+ F( B
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 v% b6 S9 s6 ?  z     ;will break 3 times :-(
" D; ^, f: k$ c1 I% U/ I2 g. s; s3 k% f! b# Z) q6 O
-Much faster:
1 |! ~" I0 h# r" w6 @   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ f: T1 D* J7 W& Z9 x! y% Q* L, Z1 s' ]9 U! [9 P
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 {! R8 s- @( I/ a: jfunction to do the same job:4 P) e) N4 m- C3 D
# p! q! X/ i! T" O* d4 P* r: U0 g- }
   push    00                        ; OF_READ. a+ Z9 g3 |$ X
   mov     eax,[00656634]            ; '\\.\SICE',00 S. i% F: A) W, r- H
   push    eax
6 P3 H# V3 G& N# o, X   call    KERNEL32!_lopen0 L# X0 ~( W; A6 [' a
   inc     eax
5 N3 c4 ~. N3 P! @3 X5 L+ u   jnz     00650589                  ; detected2 Z( M& m: i' Z4 }3 R- D. B  H
   push    00                        ; OF_READ
3 F' l' y' d8 v5 @   mov     eax,[00656638]            ; '\\.\SICE'9 o) ]9 ?3 z: j3 C) w
   push    eax
+ o; C; `; i) I0 N# O/ E   call    KERNEL32!_lopen3 U* Q; y2 j2 k! k
   inc     eax# s; B* R) Q3 g& Y- H
   jz      006505ae                  ; not detected
/ ~9 s& c% ]# D3 ~' ~! }, M" Y1 N0 T

7 L# k! X5 ]5 l; C2 B7 W, @__________________________________________________________________________2 y& v3 \  ]: S! H! j, f* t
6 J1 M( q: h6 Z$ r8 }5 V
Method 129 C" s; K' d& t% _$ x7 E
=========
( A& [+ E* x3 m5 G+ g6 F3 e& d5 A" w. q
This trick is similar to int41h/4fh Debugger installation check (code 05
& j5 A/ V: N& ?' }$ z&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ }3 a7 H, }0 H# P( e( e: Y0 t
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* R* e4 Y, x. o
8 X& f* c$ K2 p0 p, ]" n
   push  0000004fh         ; function 4fh
! P4 ~- \! \, \& ^- T9 }9 e   push  002a002ah         ; high word specifies which VxD (VWIN32)2 I. J- d( h! q" D( w; Y* U
                           ; low word specifies which service! a% l& `1 x7 X' |* G; L2 K
                             (VWIN32_Int41Dispatch)% H$ s1 u" X/ b8 g  L
   call  Kernel32!ORD_001  ; VxdCall6 f+ n3 f- f4 l/ c7 Z; s( g3 G3 \
   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ v9 B  J- t0 D4 |: M4 R% @   jz    SoftICE_detected. {! y3 m5 b9 \* N
& `( J- h0 x/ c# d
Here again, several ways to detect it:
/ R+ x! O' L  Q# P. C; N" u# A: e) o( ^% K. {5 N
    BPINT 41 if ax==4f9 F6 J" P5 {) c6 l
0 X( i! \  r% ?& P, q1 D7 D
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) H* A! g/ U- a! z/ R) g' H
% `4 Q1 B. Z7 c1 o5 u) e
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
4 N0 U5 x# l& k+ ~
" h# o/ e6 S7 ^9 o    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
% E' U: X8 ^8 ]" ^: w$ {2 z8 |4 K- d0 P8 X, Q* {+ B' J( h
__________________________________________________________________________
+ T0 v1 B2 u9 p; e5 j, B( S/ e" ]) w# s8 {  g( e3 [4 Q  _' T
Method 130 E0 F3 ]" i. n( P- H
=========3 R: v: g+ h1 Z) ?" ]

1 D% F& [+ R" [$ k& ONot a real method of detection, but a good way to know if SoftICE is& F0 v! A7 f, K# O
installed on a computer and to locate its installation directory.
& ^2 f) n* b0 r4 p5 m' _9 ^It is used by few softs which access the following registry keys (usually #2) :
8 M; V. z" t9 S, k+ x- x" N2 C
+ R0 Q. \, |2 Z# n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: z% `$ b2 [7 z) D; @8 a\Uninstall\SoftICE$ ~6 i  `. _! V, m! G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 E6 s& U. H$ ]2 k& V) _3 D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) K# x4 n  L% u7 s9 T$ Y
\App Paths\Loader32.Exe
% Z3 S) c2 G$ R3 s% n: v. ~
) J; N2 E3 V4 |, W  A9 U* k8 e/ C3 p; l, h1 n& R/ Q
Note that some nasty apps could then erase all files from SoftICE directory
& g( T# W7 T5 M) _. x% y) z(I faced that once :-(
$ e* F% `7 B4 q  ?9 Q: M5 J6 S4 x- r' M5 h
Useful breakpoint to detect it:, O/ {& l; D! u0 j

/ [( F1 P( y1 B0 b1 q* ^$ S     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  Q( F7 G+ J/ c, {# v" \) y# Q0 O& {5 F  H4 J. I/ H2 @
__________________________________________________________________________4 a3 ^) H4 b9 h6 L, H3 f" c* r+ A
  y: i! p6 u. y

$ O9 w7 G8 d# o3 u5 Y" sMethod 14
  @+ B& u/ _1 u' r" `; j  r% b=========
# S  d& n4 r' i2 M2 a+ n4 f7 G1 L5 A9 c3 M
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ S2 n' B) |( u$ y% `7 b& R
is to determines whether a debugger is running on your system (ring0 only).
" k+ t. N; N/ l0 y% J8 Q
: F$ h! M! x, B8 P   VMMCall Test_Debug_Installed
2 \+ a3 n) v# ~   je      not_installed7 e9 ?( |* D  r) M/ e# N  N

  \6 P" C8 }) Z) A+ o* X1 t5 j1 I, ]This service just checks a flag.
# S  c, v& L2 c, h  \$ E) v% D</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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