About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 o( J+ G7 J) C0 d& L% W
<TBODY>) G% k1 M8 I3 H& q0 c; w8 W' [. }
<TR>, n' [: r0 d( l% X. P! e+ f
<TD><PRE>Method 01 7 a. T1 k4 A: d
=========
: r* k$ \# Q: k6 F/ q/ Z4 {' N8 d) [9 w6 w  b
This method of detection of SoftICE (as well as the following one) is/ y6 ~5 }7 }6 c
used by the majority of packers/encryptors found on Internet.9 R5 W- v+ i- a2 v$ N
It seeks the signature of BoundsChecker in SoftICE' U9 x: i0 u4 I

2 a& v6 B$ C6 A    mov     ebp, 04243484Bh        ; 'BCHK'
. Z7 u1 |* p% a; a, S  g0 n    mov     ax, 04h/ J; Y8 q7 ?+ k( D6 Z" }% ?+ M
    int     3       " U( f' m1 y8 @+ d5 d0 C; v1 W6 R, d
    cmp     al,4
3 c# e' s6 ~' ^8 l4 ]# V# x    jnz     SoftICE_Detected4 K! y, ~9 Y+ S& U0 j
( V3 @- L6 G+ ^2 n7 Y" L4 V4 m
___________________________________________________________________________
3 q3 Q& ?" g; T& s$ Z2 J5 Z" l% @3 V5 g6 H1 j
Method 026 ~* R5 h# o# D* F# ?% M! u
=========+ Z* j! o0 q8 G+ k6 K2 k' j8 E

5 N) w: _" R9 ]! V( FStill a method very much used (perhaps the most frequent one).  It is used
6 o, c" e7 n2 e7 x7 u7 s9 `4 Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ o& A: h4 a* f0 }* N  A
or execute SoftICE commands...
+ {$ V$ V9 q3 u6 t$ r: ]4 iIt is also used to crash SoftICE and to force it to execute any commands
+ z' ?% n% J9 h$ x(HBOOT...) :-((  
- x# c4 f; |1 F9 x8 u  _
2 @$ @" i/ {8 Y) D8 m) F9 e2 oHere is a quick description:$ w' ]7 ?$ }4 f% W, b4 Q
-AX = 0910h   (Display string in SIce windows)
* v$ D; a6 T; H+ t  b7 p-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* v8 S: |- y, {7 h/ V. D-AX = 0912h   (Get breakpoint infos)
+ _2 C3 g5 ~0 a+ P-AX = 0913h   (Set Sice breakpoints)
- J7 q# u* f- J1 s$ t9 R-AX = 0914h   (Remove SIce breakoints)) y7 q( k; L* W; Q2 u" h6 K& y

3 I5 H( M" X: TEach time you'll meet this trick, you'll see:; y  g: Z; k/ `; b7 |7 L
-SI = 4647h
' n  W" h- I# @7 s/ {. J. f' b( U-DI = 4A4Dh
6 k' C' Y, E7 Q6 |$ ^2 iWhich are the 'magic values' used by SoftIce.
: G8 {; ^6 a; _: |" nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.: B; n2 z: X" q/ ]* X: i
1 [2 T2 o- z$ g* ]9 ?
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: z+ m1 r+ A. p3 G  REnvelope utility use to protect DOS applications:2 g+ ?7 z' r" ]$ x9 ?% R+ x) Y
, r( z1 T3 D; y( ]

; \4 `' _. z- ~/ }* o3 Y) Y5 o) C4C19:0095   MOV    AX,0911  ; execute command.
/ b: X+ l: K/ ^8 D7 b4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
- ]; \$ q6 p+ Y, A+ ^' a9 `# x# C4C19:009A   MOV    SI,4647  ; 1st magic value.
+ a$ R  b( [# u3 y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ g( _) D# l( B* E  M4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 o" A% [3 }( {; C: I- D4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ b: i- }2 v7 C1 i; Z# L2 y. e
4C19:00A4   INC    CX5 A/ w7 g# T* H) ]- D
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# l2 c: x0 _$ o; j, F" d4C19:00A8   JB     0095     ; 6 different commands.
: {  M2 B0 c, b& n& V4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 ~" L, f5 h5 z0 I4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* ?; u0 a# I$ W0 R; v  A. f# l2 W4 t% q  q+ Q; z) Z. q
The program will execute 6 different SIce commands located at ds:dx, which2 a$ y. j; `# K$ ]: Y4 B# I
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' g% i- g$ H2 w5 {4 k6 @. R' ]0 P/ X, P; Q
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% i( E. R; m% R# x' r% T$ B. X5 F
___________________________________________________________________________
: y# d' `6 p7 M5 {2 i, B" b9 y3 Y; D+ ~

% M) C! Z, }- D9 {. {/ S" [Method 03
! h  H' S" D5 Z- l=========4 f( V3 \; h$ o( j) P0 r5 q' W

7 r2 {9 c, W# w# DLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- U: i! E: `- B(API Get entry point)* S6 z) e* b2 K! x& R( A& [
        ! t4 a2 H" W3 E; u* q7 f
" Q6 m# z8 C! u2 D2 n; U1 C7 O
    xor     di,di
4 i8 k8 z0 F+ V9 m8 X    mov     es,di
# g1 K1 I: G# K5 l* n7 u' E. j, c5 [    mov     ax, 1684h      
( S; X, x# N  h; r" q( L    mov     bx, 0202h       ; VxD ID of winice9 c/ m% f+ Z0 R: C
    int     2Fh
6 K( h' Q/ g) i/ @; a, D5 l$ c. r    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! J1 r) q( S0 A. A: B    add     ax, di. _/ W% ^; s$ H2 Z4 S
    test    ax,ax8 u9 A9 v/ o! f5 v* {" j
    jnz     SoftICE_Detected
" m6 T8 t: u1 C  h' g6 c: ~  r, v* D9 x" D
___________________________________________________________________________& W9 A& o7 I7 v( r

/ b) {* u1 }* V# j: r5 VMethod 04  k% y& ^9 s% l3 ]1 z5 P
=========
/ F0 R! |1 f+ J1 {9 h% L
" ?- b$ p# l! A/ m- T  R5 ]Method identical to the preceding one except that it seeks the ID of SoftICE! _* X- K9 g& Q  X1 H2 Z
GFX VxD.
$ v1 W1 n2 U* d: Q
0 Q% Y! Q  n" q/ m. v/ t    xor     di,di! J4 s; _7 [' \. y6 b( M+ X9 N
    mov     es,di% {( [& J4 j( Y7 ?5 z* \6 v: f! H
    mov     ax, 1684h       ( W) G  ]( m; i/ E7 F/ D
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 u$ z/ P) s% e% o8 L3 t
    int     2fh
" O$ k) ^3 ]# m' w+ i; l. d    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ M7 F  E. G; H/ n7 b  `9 E
    add     ax, di& W& \9 N! X4 b0 a
    test    ax,ax- ~7 B  S2 [6 G/ w
    jnz     SoftICE_Detected
6 U, _5 h' d4 a$ m& b: d  A: O( \+ ^! i4 A* g* O
__________________________________________________________________________; M5 y1 d" H5 E1 e5 ?8 D

6 ]# s9 q, S( s/ f3 y
. |9 x. o& {5 g+ y3 S% UMethod 05. |" V& p- e4 G* u8 W
=========
6 C& _$ c1 J$ ~* o' @( }" A& x5 ^( [% _
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& _5 Y$ ]1 A/ i, s3 B' Pdebugger. It calls the int 41h, function 4Fh.% C5 ?7 o) ^& ?5 y  `9 D6 J* N
There are several alternatives.  
- [! B* n+ l2 C! _, h- ~
' ~1 k7 B3 q" a: U  qThe following one is the simplest:& l3 m! r+ }; K( S
% q2 A5 i. X* l' c- W
    mov     ax,4fh# _! y. K' E; B( ]( T* y6 V1 u
    int     41h
" S1 q( m: _. i+ [  ~% Z2 O    cmp     ax, 0F386
9 p2 O; @) b% @$ {2 ^) z( ]& ~    jz      SoftICE_detected  f) }) S. n. u% t: X# P% W, m1 t6 v

; V! n# U9 `8 r4 \0 G, W/ R& g& U7 }0 l5 b; P
Next method as well as the following one are 2 examples from Stone's 6 h+ ^/ O3 a" W$ D7 e
"stn-wid.zip" (www.cracking.net):; r  G6 c) Q& R; @7 k

; u. s. b, [" B7 B$ x2 z; w. v    mov     bx, cs
4 ]; X3 C1 g6 Z0 |* n0 @" S2 T& s    lea     dx, int41handler20 y7 z" X& {9 b' U/ S$ e
    xchg    dx, es:[41h*4]/ d/ o, m" ]% S, M  b
    xchg    bx, es:[41h*4+2]
$ u+ Y# L5 K% g( Q    mov     ax,4fh
( g6 k' F' I: M# e1 c# W    int     41h
% _- j& J6 e3 f+ p$ U3 A+ t    xchg    dx, es:[41h*4]+ S0 v1 \2 w- y7 J# K5 j) [
    xchg    bx, es:[41h*4+2]
2 w* _: C, w5 V$ s* D3 z    cmp     ax, 0f386h
5 D9 C9 ?1 G: p) w# T    jz      SoftICE_detected! `3 y& q- J! g/ O# A) r5 Z5 a) Q
' m# B; {0 d2 ~/ F) a; O
int41handler2 PROC- W# L2 g4 a7 o- W5 b* S4 }
    iret
6 k9 D4 b' \% U6 o( j- f+ `; m  y! Lint41handler2 ENDP
- h4 |/ Y( O! j+ y
- k* u3 ^( W/ Q: a& m7 q! o
, d8 R! a6 L/ Y" s+ X_________________________________________________________________________
( d! P" w* M5 J( d
. U# b; L1 j/ V! [1 c# a  x* D: B
Method 06
! _2 M3 e. w# o: \. ]2 M=========7 W% p! K' v% c
; a* p2 L1 ~+ h. Z7 C( L
! |1 |! n  Y7 a' N$ X2 G) h
2nd method similar to the preceding one but more difficult to detect:! d; a6 V% `0 t- G) ]6 |; F# R

: v; ], i1 _& i3 q+ E" m; H! q: O- j
7 I( p  Z# b4 }8 h: F- a/ bint41handler PROC
$ A- @( p; Y+ A3 u- X0 B    mov     cl,al
6 w* n. ^- M' x8 G5 B+ `# Y    iret+ R, s  b% A& W) U+ r$ h4 c
int41handler ENDP
$ x) v8 x+ I0 @: y9 T1 `) C  Q; h) @1 I# R2 k
# W1 ~2 o# \, Q8 Q, T, Q: \# ^
    xor     ax,ax; K, F! Z* h3 T' v: [3 A! j
    mov     es,ax( b3 e- g! z- M' T
    mov     bx, cs1 L# {! a7 l& x/ R5 F; `- P
    lea     dx, int41handler+ J' g2 O4 v( K( g5 \
    xchg    dx, es:[41h*4]
& }1 X* y* ~5 J3 H$ F    xchg    bx, es:[41h*4+2]
1 J$ Z  j% ~8 z, d    in      al, 40h
4 V6 R. S/ M0 h% G& G    xor     cx,cx
" z9 i. b4 R- K: g) @    int     41h
3 X; A* v( B: v1 d) V    xchg    dx, es:[41h*4], |1 B+ M. c/ c! `7 D* {
    xchg    bx, es:[41h*4+2]! k& L3 c8 K) ?, A: Q* ^/ i6 U) W9 v. l
    cmp     cl,al
( O) M+ H+ u# X    jnz     SoftICE_detected
, y  @; R/ s: t% p% L4 Z/ D. R$ T- ^0 V& E6 c
_________________________________________________________________________$ o4 w! N" `/ v( R6 B& Q& a( H6 R

) b! T  n+ z% Q1 F' tMethod 07! Z! o1 y8 f+ s9 A$ m" \% p% Y. `' u
=========4 J: J) A" @* X2 i7 ?
' B# ?* A% b  p  B
Method of detection of the WinICE handler in the int68h (V86)9 R& T' \! O. g3 [  ^

- b8 d7 i" i* B. I1 g4 H( P6 Y) z4 ~    mov     ah,43h
2 }  _0 A4 I& V9 c    int     68h
5 f1 |  H1 C3 X' N6 R+ N$ _& j    cmp     ax,0F386h
1 t8 V* O7 u5 b2 _    jz      SoftICE_Detected
  T( ^+ j' q3 G3 s! J/ C8 @9 W
- {  J- w! T! z5 z4 d+ V' @9 Y7 M0 R$ `0 g2 v3 f; D: F
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
+ T3 X1 k% e/ t3 O' `   app like this:% Y1 E* b9 I( r( e* L
: T+ Y9 `+ }3 [
   BPX exec_int if ax==683 s+ `8 ]  O; x# Y* a
   (function called is located at byte ptr [ebp+1Dh] and client eip is/ L0 {, g+ `: b0 p- }: Q
   located at [ebp+48h] for 32Bit apps)
- B' ]( W0 S; i6 B+ }2 c__________________________________________________________________________
- t' H: T% ~) s  P
2 w8 N$ j  \6 d% l( w& S, g% i7 Y( m) C- I) T
Method 08+ o: o; Z: k1 o
=========+ v3 W* u* V# c$ ~' z2 }
) j5 m/ x( @' Z& |
It is not a method of detection of SoftICE but a possibility to crash the! x: C4 c9 x: ^0 x( E: A2 ^
system by intercepting int 01h and int 03h and redirecting them to another9 z& L' g* a  ]& J& U
routine.
# r% [# s7 g* ~: vIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points3 \/ I+ B* H4 U
to the new routine to execute (hangs computer...)
- Y3 s- y8 t4 {* s( Y" |& b! x
3 _6 X% N' k+ `/ G! e    mov     ah, 25h
, ~! V# B. G& O3 ?2 T/ L( T    mov     al, Int_Number (01h or 03h): Z- e+ O6 j& O- @- l) z' u, |
    mov     dx, offset New_Int_Routine' b1 M7 \3 }/ a* U0 `+ i& n5 e
    int     21h: O2 Y8 b+ w7 i/ ~
5 ~  G; @- j6 {! x0 t
__________________________________________________________________________  d& \; `3 U4 Z
: ?, M  Z# D  f+ D; v+ h  U
Method 09
& R# i2 B7 J/ |% u9 X3 i$ D=========
: S7 c# Z5 S- k: P/ E: i$ u
( ?$ F. \8 c" O1 J7 ?) ~: O% HThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 c0 T* a% h% t/ R8 H0 Wperformed in ring0 (VxD or a ring3 app using the VxdCall).
3 \, O9 }, {1 ^5 j% J. {The Get_DDB service is used to determine whether or not a VxD is installed
$ {$ x( r* u' B# zfor the specified device and returns a Device Description Block (in ecx) for6 U' _! B4 U: Z% P* A. n
that device if it is installed.2 l  j8 ?& E3 }
. D7 T9 v& G  f. A2 S
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ `+ g( Q% q6 [8 v9 A6 p9 l
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! N: x% C8 |' Y4 {   VMMCall Get_DDB
; ^9 [* [8 a( n6 s3 E) R/ s   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
- j9 @- k- ?- }) j* a6 ?  g$ g, f8 v9 {2 c5 H" n
Note as well that you can easily detect this method with SoftICE:/ k  B# F8 N9 `, ^! V- T
   bpx Get_DDB if ax==0202 || ax==7a5fh7 s* I* m, k4 H6 m
4 L0 n9 k& c7 D' M
__________________________________________________________________________
# m3 R4 d( [% T$ e; G1 L* p# p: V7 a0 A9 _
Method 10
% f) K! t* Z; e* v" V2 t=========" i. N0 J( a2 a/ N7 y# o
+ @0 _7 R1 b% ]* `! O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ h% j3 u) [9 t7 p* G4 L' n/ Q  SoftICE while the option is enable!!0 @  z+ d4 Y* v0 i4 i% W: T
3 u( l, p7 J6 T+ G( a; x! y! D
This trick is very efficient:
, q: |, x' b# u* Y4 Yby checking the Debug Registers, you can detect if SoftICE is loaded' b3 H4 p* L+ ^3 H& x; O
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if- e! P- N/ s1 n0 c; [8 w
there are some memory breakpoints set (dr0 to dr3) simply by reading their; x5 {8 x' h. i: f) Z1 a
value (in ring0 only). Values can be manipulated and or changed as well1 v2 l* L- q$ {  [! `6 x6 c
(clearing BPMs for instance)
) g% H& Z" @& j! u" e+ U2 ]( W( [7 I: [) z: f4 M
__________________________________________________________________________% f$ w8 a; ?" E- y: ^) ?0 m
) V* J) E- J( i0 ]
Method 11
8 A5 J5 |/ L5 b& u8 L=========  q7 m2 ^, L  d" [/ d
5 F% \& i: z% U, \6 x$ |
This method is most known as 'MeltICE' because it has been freely distributed
* P! ?, S$ t, k  T, m2 ]' ^6 z, Pvia www.winfiles.com. However it was first used by NuMega people to allow" F. f( l) S+ Q: u* G
Symbol Loader to check if SoftICE was active or not (the code is located
( ?) Y% i$ w+ ~; c( Z' B5 z+ v0 Dinside nmtrans.dll)./ v  G5 g( n! i: k1 _

0 W' s$ @9 L0 y! j/ @The way it works is very simple:" U1 q$ Z5 W% P7 h
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. a1 L! x+ i1 J6 @3 kWinNT) with the CreateFileA API.) j! l# [: p  J8 ?/ }
6 h" T: J! o9 ^1 v
Here is a sample (checking for 'SICE'):( A, X; X! X) M( \$ U

" C, e1 O% ?5 z4 J1 A* g2 Z( fBOOL IsSoftIce95Loaded()8 {6 z1 B4 `" V- p7 ]
{7 O2 a" k. v; a2 G5 \/ R
   HANDLE hFile;  
! R" B6 K: [. E   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 W5 X" \+ w2 \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: e/ ]6 o8 x, j2 Z: n0 v                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ o! b0 n7 _, l5 C1 j   if( hFile != INVALID_HANDLE_VALUE )
- m& Q- S; @9 \, H! k3 G   {
, ~7 u  @: K- u9 ]/ ?/ N      CloseHandle(hFile);6 f' d3 o0 ^, \2 P
      return TRUE;9 r! ?' a. t$ k5 K3 L# b
   }' u1 p! L# _; m+ `: F6 [1 N
   return FALSE;7 p& z* T7 s6 \
}: ], T- b& t: c0 I
" v5 x5 [1 y/ V3 |  {* m
Although this trick calls the CreateFileA function, don't even expect to be
, O2 g6 b# C! f: f0 c2 dable to intercept it by installing a IFS hook: it will not work, no way!
2 @3 J. S* `) i4 R; f  i' l) NIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
# m& v' {' ?. o3 K6 hservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ V/ x2 m8 J  Y- u! C
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 c5 u7 N4 m8 C3 a) U" {field.
8 a! d6 N2 u& I5 D! T) bIn fact, its purpose is not to load/unload VxDs but only to send a * S/ i) V0 `" z5 W3 ]. o8 J
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
2 a% P: [: [3 V) H( p/ G8 p  rto the VxD Control_Dispatch proc (how the hell a shareware soft could try0 r0 r7 Z7 ]4 k+ R  U& ^( \& k
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" ?2 j! i, k" C, A9 |If the VxD is loaded, it will always clear eax and the Carry flag to allow8 k/ T4 m* _$ l' y
its handle to be opened and then, will be detected.
& h* [# h+ ~  B2 f; l! Z& t3 oYou can check that simply by hooking Winice.exe control proc entry point
7 C- l) L* O; [6 R/ Ewhile running MeltICE.
; f7 ~+ ~4 M4 I! w3 y7 z
+ [! o9 ^$ h9 e4 J9 e
  i* R& k  Z- }! p4 z/ C  00401067:  push      00402025    ; \\.\SICE/ ~- T! U; ?+ M2 r3 I3 r- g' r
  0040106C:  call      CreateFileA! h' c3 ~( f! i& e; K2 l4 Z) K& j# e
  00401071:  cmp       eax,-0013 c: I- O- q4 f! Y& Y, {
  00401074:  je        00401091
( o6 X6 w& d5 R. j9 c3 j( J+ F% i) g) H: W) M1 z" D
# [" S  m3 A- E5 q
There could be hundreds of BPX you could use to detect this trick., e3 F' A6 `5 E; R! l
-The most classical one is:
$ {! t3 r8 j) _2 N' N& s  V& p: Q2 d  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% t1 {: V# \6 [' O8 S. C
    *(esp-&gt;4+4)=='NTIC'
' ^6 d/ w9 e9 Y; r9 ]! m* H. c% G' j
-The most exotic ones (could be very slooooow :-(4 C) o5 s5 e3 {/ P* j6 z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 d4 R0 v" F/ C  A
     ;will break 3 times :-(
- c7 ~0 R2 |" I# q9 w- P- S* y! z$ e% X/ K' C3 s: o3 k
-or (a bit) faster:
1 W1 |7 q' c3 S: x: ^8 @" i  A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" t, L) c* g: D$ [
% v) I6 R# a6 p' ~& {( |. i
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% k8 j! Y& |4 u& K     ;will break 3 times :-(, f0 W3 }5 Y4 G6 W, \
5 r+ D) c  n/ m# W6 d. U; U
-Much faster:* r4 A. F0 x' g% _) i% O, R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. k* h1 T; x' @. p7 b# y0 C5 k7 l7 R8 X* l  c: j
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 K/ ~- Y3 @: r  ?& q# C7 E4 |
function to do the same job:. S( x& {, l5 k4 h: H6 |7 L2 P

& n& p0 n% g6 U# |, a/ o   push    00                        ; OF_READ0 d! x% K0 U3 F; E0 T1 k. Q
   mov     eax,[00656634]            ; '\\.\SICE',0, i$ G0 U. E# l- n* y
   push    eax+ j$ ?: o; h% b) P
   call    KERNEL32!_lopen
/ s+ f6 H% u& M# h   inc     eax* T0 S: ^/ Q7 _5 E
   jnz     00650589                  ; detected
2 c0 `. f, @' {* ?9 F9 w2 h   push    00                        ; OF_READ! M5 x& @, R4 n& y
   mov     eax,[00656638]            ; '\\.\SICE'
; V* R4 ]8 f" a. b# w8 e* ^   push    eax- _# v0 L% O+ S9 h
   call    KERNEL32!_lopen
& |+ o, ~- ]; K, x* }. v/ o' C   inc     eax" N. c: G/ |- Z! m2 u+ s" G/ V
   jz      006505ae                  ; not detected
$ H# [; C1 s1 N: U" D0 z' q, p  z8 J( {5 q/ ~

& f9 h2 v+ Z0 d5 N2 n* e__________________________________________________________________________/ t! z* @( v2 o9 q2 S/ w

1 x+ \: Z5 ?' ~  Y  {/ _Method 12
6 ?2 o5 i6 \/ ~$ s2 B  v% {=========) D7 {8 _- x" E$ w& e; `6 D* ^) {
6 ^% ?1 v+ j, }' |. R
This trick is similar to int41h/4fh Debugger installation check (code 05) A5 o" }/ r2 n0 R
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 M+ y- m  q/ e5 ]+ U+ C6 bas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 F! l( W4 @2 Z/ w
; H/ f) u. a) p+ T* v   push  0000004fh         ; function 4fh
# m) X* b7 J3 N& c/ b4 E   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 C' U# i& ?, @% C" r1 [$ G4 o                           ; low word specifies which service
$ s, \0 [" Z$ X+ g5 g                             (VWIN32_Int41Dispatch)
5 e8 ]9 K: o! }! \% E   call  Kernel32!ORD_001  ; VxdCall" q$ E1 i7 o" w( ?+ ~  l
   cmp   ax, 0f386h        ; magic number returned by system debuggers
' ^" c6 ~5 z2 M   jz    SoftICE_detected
, g$ ]9 l1 U- a) L* S0 S1 n( r0 I( {& f5 B1 `2 Y  I! \) V
Here again, several ways to detect it:
+ g/ O- u: d$ W" n9 n! Y8 {
( S/ q$ g. b# J7 r    BPINT 41 if ax==4f: V5 O& ~- \5 u$ _* j& d7 b
( Z. Z! X8 t6 Z' r. ?
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( O! t0 w: I- W: |- l/ f+ a4 G8 d# L" u3 r$ p& d$ x
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. K1 `: _0 T! z
/ j* I' N7 V6 N0 f$ H4 I, w
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# Z5 E4 N  v1 p! ?, i$ I9 E8 J' U% T- \; ~: W
__________________________________________________________________________
! h4 _3 {' ^, B6 f; O% W- e+ N1 z: g6 e
Method 13) w, H- k! e& f
=========( J2 U' ~% {/ p6 j: `" Q$ \* ~

! P8 k+ G; ~4 ?5 {9 k; @$ f5 \Not a real method of detection, but a good way to know if SoftICE is
) U* {  v% w% Dinstalled on a computer and to locate its installation directory.
3 m( I3 w5 m8 m( cIt is used by few softs which access the following registry keys (usually #2) :" r: U7 u) k7 F2 T$ J3 @

- b# r9 K# b! X/ z! p) m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 a1 @# }1 T- C% U4 d: C\Uninstall\SoftICE
4 N5 _' O4 o8 L) a0 P/ P3 B4 Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ ~/ ?: j, q: e7 {1 }; A+ {" h7 p
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- r( }  R$ _& d  P; ]\App Paths\Loader32.Exe
6 V4 h8 t1 X1 ]) y8 |& B
7 O5 f$ G- C, F+ P+ Z! l
* g3 }, P. S$ J) MNote that some nasty apps could then erase all files from SoftICE directory/ h! l3 z. B) u8 [5 `. o
(I faced that once :-(( o$ f4 X0 A, }& I
1 p' A7 d! o3 t
Useful breakpoint to detect it:
  a. i% D; Z" |2 M* p# x' C) O, ~! \- |- y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
2 Q2 R4 w3 ?- e4 l) J( j2 G. i  ^8 w6 T
__________________________________________________________________________" \7 q( C1 T' G: d
/ \8 m; R- a7 U0 D, Q4 ?
% @4 ^( X% x* o7 [( r
Method 14
" V/ @- L- t9 B2 E, S# _/ y=========, _+ J( I7 {' z% e& r2 ]  A
2 T9 G* J: D# {1 ?+ W% g# |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 i  U$ p3 Q' @9 v+ d1 P; \is to determines whether a debugger is running on your system (ring0 only).
# E; F1 k7 u, |4 A1 \/ c' S- V9 _, L; Y7 ?- G2 l) E& Q, U
   VMMCall Test_Debug_Installed
$ L( a$ F, u9 B3 @% w5 p   je      not_installed
; W9 U& ]9 W' ^* j2 e, o/ O! ]/ _* _  x; t
This service just checks a flag.
+ y2 M0 w2 L  l1 K1 V/ G7 e</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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