About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% `+ Q3 s4 i( U" n; X0 e# D<TBODY>* d4 Z. x8 m9 p) t0 s& x9 j! \
<TR>9 R( T. n- K1 Y' u- w8 p1 Q
<TD><PRE>Method 01
' o8 o. x8 X, t1 u3 g' d=========: j- \/ v2 C, Y: s+ E2 B( x

8 A0 }2 I  V# T+ \: Z3 uThis method of detection of SoftICE (as well as the following one) is. p  j0 Q- G# }
used by the majority of packers/encryptors found on Internet.* E& N; o/ s5 C( z
It seeks the signature of BoundsChecker in SoftICE
) u9 ^5 D+ `7 F7 ^6 S6 z8 @
% v( ^4 ~7 D; j# F( u. @    mov     ebp, 04243484Bh        ; 'BCHK'9 Q6 d1 r6 M% K1 J0 [0 V: D) o: y
    mov     ax, 04h
1 d. a; ]& F3 l7 H# ~4 R2 Q( I    int     3      
1 O& p& q1 g3 \7 F- N& i    cmp     al,4
4 E4 U6 @" r# o5 |# [    jnz     SoftICE_Detected
. l; U& w5 w. n0 s2 B
4 g# n: A* v$ z1 l9 y3 R& D+ V  s___________________________________________________________________________& ?8 n* g5 ^/ }1 V

' J. c6 D6 h1 K' J  n7 ~" ^  {0 aMethod 02
2 Y: p" H4 i9 H=========
2 |" `! |: e' M+ v0 O0 L: e7 X
Still a method very much used (perhaps the most frequent one).  It is used8 G" j( d- W7 h' o
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ x9 V2 v4 b1 i: ]' N5 Q
or execute SoftICE commands...
  F, `. m8 U4 P( A" n4 [& H# r# VIt is also used to crash SoftICE and to force it to execute any commands* J% t$ z; U* B3 B# l
(HBOOT...) :-((  * m5 \/ m/ |$ [5 z

" K9 }/ L3 G7 a! X( cHere is a quick description:& I/ R/ f4 j7 A+ m
-AX = 0910h   (Display string in SIce windows)2 P" A0 T; d! L/ @# y4 ^5 ]
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). c7 Q8 q+ p/ a  x- n0 G: I
-AX = 0912h   (Get breakpoint infos)' W# y- ^( C# a# Y1 E
-AX = 0913h   (Set Sice breakpoints)4 V- l# U" @4 i. G( K
-AX = 0914h   (Remove SIce breakoints)
7 \2 g, u) g3 k# O
" M) J% @4 o' \5 O- `Each time you'll meet this trick, you'll see:0 f  W' L$ x* {' Y% |! g3 T
-SI = 4647h/ t- t! w9 Q$ K( s7 Y* v
-DI = 4A4Dh8 t, Q1 ]9 N  ~2 n0 g' `5 g
Which are the 'magic values' used by SoftIce.
. D6 i8 O' j$ U: ~/ H. GFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, S. A8 U) i  t5 h5 n- x; z, Z1 e( n# z% S& d8 p# H0 e
Here is one example from the file "Haspinst.exe" which is the dongle HASP6 F; {( L6 Z8 e* l1 Z
Envelope utility use to protect DOS applications:
( |  ?- n8 `* S3 B6 S+ O5 z* |5 U# I4 k) I1 t$ P' U

: l6 X9 q5 V6 N7 w: `% N4C19:0095   MOV    AX,0911  ; execute command.
1 ?4 Z2 V2 G& M9 C# n  U4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
0 g: P" t8 M: B0 E- ~; |4C19:009A   MOV    SI,4647  ; 1st magic value.3 c$ b- ~( ^: g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
: O/ {% ]/ ]: S# b4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' U8 G1 W& Y6 y3 p: a: U4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  \% a$ t2 _( {+ o. n4C19:00A4   INC    CX
" u" R- `) _9 j& e4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 V3 r* n( `  M. n3 u' h4C19:00A8   JB     0095     ; 6 different commands.
$ q: M. N8 c- |* f# P( z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 Q% x5 U& ], |! v) z" T. t+ o
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 Y1 W. w) W# r$ h& Y% g5 N
/ x7 z2 X& Y5 \. {The program will execute 6 different SIce commands located at ds:dx, which
8 S  x% Y. X$ c% W5 p% Eare: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ a  ^5 Z! }; F- N  O. }/ B$ ?

& i9 \4 u0 {- i! y( X6 D+ S' e* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ z/ m5 D$ k4 ]+ L___________________________________________________________________________1 L5 p2 Q7 e% f$ `* ]
2 _. l# ]" r% D; J* a+ j
: F3 T% l) C; Q8 }( I  {* ]" b
Method 03
# Q6 Q: n2 {6 @2 r4 z( w=========9 f; Q% ]% k6 t0 b$ q: E: e  r2 n
3 p6 m1 o1 G/ F/ k  O+ w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 o- \: ~! B6 D' S
(API Get entry point)) _. {2 ^$ g2 j- N& T
        ! h0 D. v6 A) @

3 H! j  ]. `6 C    xor     di,di
; g, n2 N# F1 _, R    mov     es,di- n6 b8 ^5 s8 z2 r" q
    mov     ax, 1684h      
5 r0 @  a1 i4 Y% k/ ^    mov     bx, 0202h       ; VxD ID of winice+ v" T% F5 G3 d- K6 ~
    int     2Fh! R! Q  ]9 o- p) R. w( ]! |, B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ |& q) d. j' |: s+ ]) V
    add     ax, di) |; n* s! O; u# m
    test    ax,ax
5 {; g- }; y* J3 `    jnz     SoftICE_Detected
: D# T/ ^  K6 t2 \# b2 B) N
( w' z6 s- R+ D6 \$ `+ o___________________________________________________________________________$ o8 z5 I; r+ G% V

- V- r- T  ?. }  yMethod 04
. a- f" [- G: {% ?: o=========
; S0 Q& B+ m3 d+ p3 l/ b- e, V( Q3 r% W1 j" V: p' x7 S7 C
Method identical to the preceding one except that it seeks the ID of SoftICE/ U3 D; m/ [4 A4 S7 g  X# b2 z
GFX VxD.
3 h, L, Y" q7 D6 T" p1 D& C/ Y9 c
    xor     di,di' A: }6 d  [* e4 c9 c7 W! j
    mov     es,di
0 H" j2 h" S4 ]; a8 o4 t8 D    mov     ax, 1684h      
( z& u  r! u3 I; X" U/ p2 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID
6 B2 m$ F; k9 h" \, @4 k    int     2fh" M& x5 l; r6 @! O9 z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. \# B0 d: P; h0 F' P% z
    add     ax, di
; k9 j6 p0 q  m! S$ G6 h# l    test    ax,ax) I% D7 l1 C9 w8 q+ q9 j
    jnz     SoftICE_Detected
! u9 U7 A2 C4 z/ A' M6 Y: L
# B6 t+ u" L9 e  d0 s, u. X; ___________________________________________________________________________
- w1 X" T7 r" v6 |
3 q* F5 C  b7 D' K2 H) |+ r% A' v/ J
Method 05
6 ~8 l7 F3 A, j. Y" j0 @% Z$ K5 H=========
0 Z* n: v# z8 O4 O6 k) x5 o, i; h8 F" N! P2 J. z# w
Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ n' b8 ^1 r& {+ U2 u! }debugger. It calls the int 41h, function 4Fh.
; Z! \2 L* U0 G/ v' {9 U: zThere are several alternatives.  
) G0 u* D$ K8 c0 Z4 F9 v5 a) v
% Q5 O5 C( K: }* NThe following one is the simplest:3 d7 T: w8 h6 k9 i& h
- r) r. q( I' t9 `5 w% t1 T- f
    mov     ax,4fh
- T2 }+ v  h7 G- N1 X    int     41h
2 y7 C3 @% q7 z5 s) g    cmp     ax, 0F386
9 u' v' x" D% d" C: }! f5 m    jz      SoftICE_detected% U0 ~2 h) P* e" f
( b9 D! B* ^- W) u. B. w3 j) J$ b

4 Z' c$ I. M8 `Next method as well as the following one are 2 examples from Stone's
1 A6 v, H' o4 W"stn-wid.zip" (www.cracking.net):
+ f9 V) k  O- Y  {0 `* W8 m
# k$ |" f) y8 S7 @& _    mov     bx, cs
5 L6 H, [4 J1 V' k* S) u  y! Z& r    lea     dx, int41handler2
, e% e+ y  r) {5 t    xchg    dx, es:[41h*4]* V: c/ P0 L7 z, v) K3 C$ u
    xchg    bx, es:[41h*4+2]0 I: l+ S* T# t; q$ c; o6 A& Y" G
    mov     ax,4fh
) [, p/ c6 ^8 x/ T4 N/ `, x    int     41h
# t+ G2 Y6 U+ V; j$ x7 V    xchg    dx, es:[41h*4]
9 A0 g3 R' Q' r% ]! d# M( D. p# t    xchg    bx, es:[41h*4+2]
" e- y2 E* R" c+ ]$ I* `! `    cmp     ax, 0f386h
7 z5 x6 t" u' y+ I- G$ L, n    jz      SoftICE_detected+ ]( Z" Y) D1 {0 T  L8 v" Z1 j

# \* q1 }7 u/ q* {! d) rint41handler2 PROC+ Y- R1 l' h3 O/ h
    iret, u1 C9 M7 k5 S/ k- z$ b
int41handler2 ENDP, Z1 B( j1 ?7 _$ D) E; X' Y# |

. U+ A6 [) p% a: E3 K( S6 \; `4 m- B- \% q
_________________________________________________________________________
# [# W6 C' d, \) Y+ o
/ U# c& `* n$ _% Q2 }& p/ c3 r2 L* S7 ^0 Y4 x
Method 06& ~% i& n1 b& u6 L9 Z
=========
; N( d  Q3 H" D4 P' H" J+ A/ A+ y9 l* ]  R2 e; F/ M! y

5 A$ ]+ c' w2 l7 m) x' Q" F2nd method similar to the preceding one but more difficult to detect:
% D  N2 i2 j$ C; H! |" v& u* c9 \/ ?9 w; O: O& \. d/ _; D) o
: X# t) H  [8 T! _# F  e
int41handler PROC
) m. ^5 k1 v5 B! E2 X' F, m    mov     cl,al
0 P! b* Q6 s# Q! {8 A    iret1 Y5 i9 n8 m8 a7 p, P/ O& [
int41handler ENDP5 Y5 k5 d9 e  u! b# v$ b, z

" i# n7 F7 E' ^. d( z" _: U$ B" U9 {4 c
    xor     ax,ax
) O4 W4 f, b; o# F; X    mov     es,ax
( g# M5 T% q0 v/ Z+ v1 B. r9 u    mov     bx, cs
" \0 Z( x1 w2 S# n( s    lea     dx, int41handler! \( x$ h$ ?: T0 h9 r) D, |
    xchg    dx, es:[41h*4]
  X0 \) g6 D! ~: E& l& [" |    xchg    bx, es:[41h*4+2]; G0 Z' g. X' V
    in      al, 40h
2 `* O0 E2 G' J" C' A    xor     cx,cx
, D2 X! v# L- C4 A    int     41h
. B" C  e  @+ ^6 m    xchg    dx, es:[41h*4]
. ]3 {$ |3 n  v9 Y0 H  @    xchg    bx, es:[41h*4+2]
" s: o& A& ~8 T' [    cmp     cl,al
( M) p* d5 o7 V1 p    jnz     SoftICE_detected
0 v" s5 X; q' O  K) @7 T( J& a% h. |: p' [/ M
_________________________________________________________________________5 j2 Q4 C2 {. V+ ?% |0 J. K- |9 M

, T& r" G1 c3 v" |6 bMethod 07- \  y; H' s$ G/ \- N+ m( ^
=========2 d7 v! q& S/ B' O' I7 D
2 |! j4 Z4 W; T8 {: k* S
Method of detection of the WinICE handler in the int68h (V86)8 a5 t! N, @9 ~! g

9 t$ \/ u$ o% n9 z  z" X, g3 Y    mov     ah,43h
5 y& j9 [5 j2 r# u    int     68h
& T: f3 W- J+ n- X: s    cmp     ax,0F386h
& a5 U: j5 M' j; Z; L' ^  F; d    jz      SoftICE_Detected* X+ o; f6 i4 e

, n& D, p* }+ o% i& J9 a1 w& z3 _* d- i
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# u+ m3 a$ ]+ b& r   app like this:1 t- p. K2 d1 X) w, F: |
: m$ D& j- U' H/ g& ~
   BPX exec_int if ax==68" ]9 b& L9 W, ?' b6 s( t2 a2 d
   (function called is located at byte ptr [ebp+1Dh] and client eip is, d6 M' z6 R) @8 c% c
   located at [ebp+48h] for 32Bit apps)7 L% A5 f/ g( q+ X
__________________________________________________________________________+ z; e) d! f' P

! q4 S! a. u' v- \8 |
  h( d% s! T9 p4 |8 L: f: K4 nMethod 08
8 F, G* ?2 S& b2 V=========7 F$ u! i4 X4 y' e# w
  K; c; A5 V8 I0 v6 J, w
It is not a method of detection of SoftICE but a possibility to crash the; F0 g4 J2 ~$ E$ z0 R7 Z+ ~
system by intercepting int 01h and int 03h and redirecting them to another
$ [4 [4 Q/ l4 Z* p$ {/ ]' Xroutine.
" l9 a1 q3 ^( m6 p+ NIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  n3 A( A# [* m' z, ^0 Hto the new routine to execute (hangs computer...)$ [0 r! ~# ]* i) I; n9 S9 D

+ N: R% K- _6 E, _0 h% x    mov     ah, 25h  m4 I+ _5 q) X3 i8 Q
    mov     al, Int_Number (01h or 03h)5 Y# g% [. t3 ?& E# b
    mov     dx, offset New_Int_Routine
6 _% R! ]& W; g! A% }    int     21h
5 d8 N' }" |/ S; @
# e0 e' y0 I6 A; ^5 R- t! F, k  \. S, B__________________________________________________________________________
- w6 V4 l% n! Q8 U
* {6 ~! H4 Y) e; d: _+ }. FMethod 094 A3 `" F7 H% M4 w0 r( H1 ?
=========6 R2 P& I* Z# c* {: g$ Y
8 B: c0 X7 K5 ^8 v7 |, g
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
6 I7 O6 D9 ^/ t$ eperformed in ring0 (VxD or a ring3 app using the VxdCall).
( `- b* \( b! u8 j+ M* HThe Get_DDB service is used to determine whether or not a VxD is installed
; V# T( |$ Y/ u) dfor the specified device and returns a Device Description Block (in ecx) for( G( |  R9 d. o
that device if it is installed.
1 D5 H% p/ h0 R+ Q8 @( R+ y% D
3 s& j# M* A1 H$ C. d; [   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" {3 h2 W2 F5 E   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 J6 r$ [( _, c* v9 ?   VMMCall Get_DDB
) o% D; r' ~; C$ i1 l& T3 H9 {   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed7 e2 u% ?2 `0 }* a6 q- U

1 H) e( L* O5 PNote as well that you can easily detect this method with SoftICE:8 K' M9 {4 T% W; B* o$ Z0 Z
   bpx Get_DDB if ax==0202 || ax==7a5fh" G/ M1 X  Y8 H

: s1 T7 w% w) L; B$ M( A__________________________________________________________________________
: U* a9 q/ N. v; @* B) P/ u1 N. _4 ~8 m+ t4 A
Method 10/ j. x' P+ {2 o5 ^  Y0 m
=========
; |& _6 G. z4 b9 ^
* g# t" y- `1 i$ J=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 I8 Z+ h/ K9 T  c$ ~8 n0 M
  SoftICE while the option is enable!!) |  a8 i% w' g  }
$ F: s& x) X3 a  [5 _: Y# R% I, ]- y( U5 R  q
This trick is very efficient:
' I% A, |6 a* T6 Iby checking the Debug Registers, you can detect if SoftICE is loaded
. t; [7 j8 W3 k) O. d& W6 c(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ Q. U: ^) @+ o& B4 pthere are some memory breakpoints set (dr0 to dr3) simply by reading their& W0 B4 g9 s1 A9 B  V3 p1 H5 g" D6 O
value (in ring0 only). Values can be manipulated and or changed as well
8 B+ T6 Z+ i: {: R: ]% q5 M# G(clearing BPMs for instance)! W6 V% B' S2 L* N& l9 t5 K
" s4 v* n2 w$ e6 \
__________________________________________________________________________
: o0 G9 I/ j: o: g9 W4 e
* c9 s! t) a' w: eMethod 11
6 d. l+ U6 I3 I- q/ a  G=========- @7 J6 ?2 G/ x3 h0 Q8 F5 O
3 f1 l7 q: q( S: E% p( e; G
This method is most known as 'MeltICE' because it has been freely distributed
: X9 R  M9 o8 F/ r3 u5 Wvia www.winfiles.com. However it was first used by NuMega people to allow
# L; F; S8 R2 _1 n  ]Symbol Loader to check if SoftICE was active or not (the code is located
3 B' y0 @: r- N0 t+ f+ ]$ M4 yinside nmtrans.dll).0 [, o+ Y, H0 {$ P
$ k) x# O+ V/ E# _7 L7 r
The way it works is very simple:
  E5 q' h' O4 N* ^  nIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' B# w0 j6 K( E
WinNT) with the CreateFileA API.
+ m8 Q" E1 e; b4 C/ _$ q
# E2 @. o0 E, ^& [9 K: H6 eHere is a sample (checking for 'SICE'):
$ h: W5 X, Z4 `! d
& _7 k' P: A; F& q  k8 PBOOL IsSoftIce95Loaded()
7 k( C1 {+ k. ]! v/ R{! e. c/ m8 E2 n' K4 g7 H  I# i: ?
   HANDLE hFile;  0 v" h( \0 P% Q/ ~( P4 E2 W
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. u0 B% u) K( l5 J5 Y* a% m: q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 {! @/ q# _! o/ M9 l# W3 q4 `' p
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 W  E- u; |& |( r, Z6 C& C
   if( hFile != INVALID_HANDLE_VALUE )
" K; y; w" D* y- B   {/ G% P( G$ p. z" I5 x$ e
      CloseHandle(hFile);% ?4 p+ g% y9 g0 `
      return TRUE;
) r0 I. Y9 v1 T2 a/ N" l   }( I; M& n) ]7 X
   return FALSE;
8 u4 Y7 A) V# S% _# }}
  U7 q" R: ]4 L7 `
; r4 U' k5 @  mAlthough this trick calls the CreateFileA function, don't even expect to be1 }3 v" F/ ]0 v9 j( S2 a
able to intercept it by installing a IFS hook: it will not work, no way!
9 U2 {$ x  _0 ]' k1 GIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
* D; W& a% ^/ P9 F7 m1 q" H' }service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# \- k+ |' J! v: uand then browse the DDB list until it find the VxD and its DDB_Control_Proc
; z( ?( N% O. s7 h9 _field.
* S# i5 {! P9 X+ MIn fact, its purpose is not to load/unload VxDs but only to send a
( m: K1 l3 `2 [2 k4 E5 D- i' ZW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- `8 |) Q/ e* e$ V8 w7 Z% r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try% \+ p  v: V, m' c% m
to load/unload a non-dynamically loadable driver such as SoftICE ;-).' K5 o! }$ i8 b& e2 O
If the VxD is loaded, it will always clear eax and the Carry flag to allow
- N; `; E) {, ^$ Y) h) \- y7 oits handle to be opened and then, will be detected.4 h' |! q. T) A% S
You can check that simply by hooking Winice.exe control proc entry point( A9 r7 u9 `+ e" j' I9 }
while running MeltICE.
& j( b' D4 R) ~( f3 r6 @- q2 W
8 t$ u& I. E2 J# _3 F' A5 E1 R( \. [& `. E. D; M/ ]
  00401067:  push      00402025    ; \\.\SICE
8 {& K: }) s+ l4 N0 M/ e$ c  0040106C:  call      CreateFileA
' Q- R" J  c7 y+ y# Z' v3 T- d  00401071:  cmp       eax,-001
  X7 g4 q% A5 O9 a% D$ S  00401074:  je        00401091% f1 M' P! |7 K

& O% R3 `4 |  X( v% U* ]
6 ?1 [( j  Z. `- tThere could be hundreds of BPX you could use to detect this trick.% f- T4 [. |9 ~+ _  x# s
-The most classical one is:
3 ?/ S0 ?" r8 _3 G$ |* k  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||, R2 [/ @5 s1 V; Q' k4 X+ I/ e; c
    *(esp-&gt;4+4)=='NTIC'  N2 M9 O! J( y5 Z* W9 t
, w5 M' ]' U! T  L" O. L3 n
-The most exotic ones (could be very slooooow :-(' w3 A- ^+ }0 l6 s; `2 \. d
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% f& }* @6 V% P: D7 j3 t$ v' N8 I8 R     ;will break 3 times :-(( m2 H: ?! |) s: h9 A8 {* H
2 B1 ?0 Y6 v3 y( W0 C4 c& M
-or (a bit) faster:
7 r6 e. b8 P6 i3 K# j/ F; d8 X   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')/ c1 |- ^# A+ m$ f# `  C/ ]) A

! s. \3 b- y0 d( O2 a# c! T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 a4 r2 d9 ~2 T5 v* b% B4 B: I     ;will break 3 times :-(
; ~6 a$ G- W7 S2 M6 Q' \  i, N" k7 }' K3 d( \  {
-Much faster:
/ ]$ G3 {& n5 \. k0 v# E" X0 s/ e   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 z9 Q- ^4 o3 [; Q8 R
( f; K2 m! s3 J* U0 r; L& a* Y/ o
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, ~3 r8 K" S/ Ofunction to do the same job:6 B  `6 x( U+ H4 E

2 U) H) Z0 s2 K8 C. C   push    00                        ; OF_READ3 M5 Y# Q% Y( D1 A' u
   mov     eax,[00656634]            ; '\\.\SICE',0
( y6 }8 Q* R- w9 q/ z   push    eax- W# U1 y/ ]5 ~. L& R+ z1 H
   call    KERNEL32!_lopen
; c# E0 J! ?* Z; V   inc     eax! P4 Z' M) I3 f) {
   jnz     00650589                  ; detected
" a( @$ o* u/ Y+ Y   push    00                        ; OF_READ
7 B: H+ f8 R5 m0 i( e3 T   mov     eax,[00656638]            ; '\\.\SICE'
1 r, X* A3 }0 B/ ~# \8 g" Y6 d: n4 X   push    eax
# w& m3 L! c$ O0 w" y. j6 p   call    KERNEL32!_lopen9 J6 S9 }; n$ n: H; c; Y
   inc     eax
" b4 {" ^9 p/ w4 F   jz      006505ae                  ; not detected
: z+ b& F% O8 s, a
& \* F1 E! i  r" E2 M8 C% j$ G" l( L/ a4 ]) U/ a$ f8 Z
__________________________________________________________________________  P  z( D% x  ]6 D( m+ q) V0 F+ t

* k; T5 s4 V+ e7 IMethod 129 f% M4 H' T5 ]4 p  r0 X" n
=========+ k& K$ h8 Y* [7 t, F' R" a- R
' O$ G, ^( S1 x( V1 q. `! r! {
This trick is similar to int41h/4fh Debugger installation check (code 059 v9 m; Y: e5 [2 s9 q9 {! Z0 t4 X
&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 f  u0 ]- _/ `% Y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 P* N, X; K! ^6 T# ]  d# C4 Y( C: _; p: O  s
   push  0000004fh         ; function 4fh
3 ^. L; z6 l+ o   push  002a002ah         ; high word specifies which VxD (VWIN32)! X( \& q4 s6 P3 k' g* J
                           ; low word specifies which service
; y1 L& f5 \' g                             (VWIN32_Int41Dispatch)
8 o6 R. H* z  ~* m; y   call  Kernel32!ORD_001  ; VxdCall
8 M: k, V( w5 l# ^# ~2 q* ?4 g/ e   cmp   ax, 0f386h        ; magic number returned by system debuggers4 o4 v, n5 V; O% ^+ s
   jz    SoftICE_detected( n4 n7 W$ r( \3 f" U

* B9 t+ x& C: C$ ]- dHere again, several ways to detect it:
0 V  F  _3 T* z/ D2 {  ~
) Y$ r/ g" m6 ]    BPINT 41 if ax==4f
3 U$ k* J5 C, i! R' u2 m# g8 R4 y
! e3 e' s& O. F, ?4 d    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one  L+ `! S% \5 i6 c6 H1 }7 ^4 D

5 J5 m! c! `  h  t& z" T0 b  [    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: ~" o$ B3 J7 J) j* m: ?) Q( v/ }2 I% M3 }3 h; p  E5 h- M8 m, u
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!# H0 j3 Q+ ], J  G: A
4 v/ i3 C4 ~% @# u
__________________________________________________________________________
: h) ?( E# s0 u, {9 d- I8 D. g; P# u# t! s. }
Method 13
3 v% X! X* k; z=========
9 _$ j# G1 J; b( {5 u
  P' T( ^2 d5 v& a) ENot a real method of detection, but a good way to know if SoftICE is
9 x/ T8 f9 A6 u) z$ l! \% K+ _. winstalled on a computer and to locate its installation directory.
7 W) j& a( R4 n0 {: A! [0 hIt is used by few softs which access the following registry keys (usually #2) :& h1 A- G, R3 ^0 S/ i

1 E2 `# t, ~4 w8 Z, z( n: U9 ]-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 T" }; P- _2 x1 A4 H& @! r
\Uninstall\SoftICE
! h$ W8 F, Q8 J-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
% n. Y+ h: G4 W- |; o-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) s8 K$ F; Z/ ~: r
\App Paths\Loader32.Exe
9 \9 N4 T/ o6 c# E: t  q7 q+ e
( O0 `+ k- |/ K2 B/ K$ r' e5 q: B2 ^& S, z
Note that some nasty apps could then erase all files from SoftICE directory
5 Q% `0 G  _* x: D! \6 M(I faced that once :-(
% B5 U1 E! i& E+ q6 z) i3 C$ p* C2 ^$ c1 [8 f5 ]* b
Useful breakpoint to detect it:
1 v+ C8 O. |2 x! ?5 z; {/ x! Q) Q
3 J$ f3 j/ G4 y  W4 `# [     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ \# ?- X8 Y+ K, E! b) U% `
. H! w3 E$ k! y__________________________________________________________________________
. w! J. w( X0 e2 u- H0 F& \) Q( I/ w; M8 y2 a- i
9 n' Z' |2 I7 [7 t
Method 14
6 |- Q( D; ?8 u5 {  T8 q) N) [3 z! j: ?=========
9 Z1 U6 @* X0 @- a4 A# C/ Z( _0 S" g* p! P% {, ^6 o
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* X- u  d. I; U2 x/ R. K+ K
is to determines whether a debugger is running on your system (ring0 only).% E" ~3 o; D- x9 @! H- W
/ i. J# W, A6 a0 d4 J7 a
   VMMCall Test_Debug_Installed
4 ]8 [& K0 f/ X1 L( x7 i. V; ]   je      not_installed4 I7 D+ f: K6 L$ l0 [( m( n
: d, ~. W0 K( s* \9 D! H
This service just checks a flag.
: j7 |7 P$ |8 E0 M</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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