About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  e, x1 L8 V* I: }2 p9 h<TBODY>
! O% T, S# z, E4 m- n<TR>! q; m  s: I% y7 v! K
<TD><PRE>Method 01
: o4 a) @6 ^+ G* ^=========
% ~& t5 \" t$ n1 P! z
* X* {$ m4 X1 l+ v3 e/ G# p# iThis method of detection of SoftICE (as well as the following one) is6 b" _8 I7 x! P% `$ Q8 V
used by the majority of packers/encryptors found on Internet.
( h1 u5 r2 }6 A' l) l. \It seeks the signature of BoundsChecker in SoftICE
. z% O* l4 c0 J8 F$ Z) i
; b% a  s; U7 t! L3 |$ J    mov     ebp, 04243484Bh        ; 'BCHK'; X: ?" c3 r+ J# E, Y, `$ S. d
    mov     ax, 04h
# p. [; X: D* \    int     3      
) W* e0 f9 y/ I2 _    cmp     al,4
' M+ `+ ~* a; J! ?. `$ ^    jnz     SoftICE_Detected: y4 ^! B  l9 P- Q$ k
1 A4 o5 A$ K+ I: r2 H
___________________________________________________________________________
0 y* B" X! M! T0 i" D7 g
  U) U6 \% N8 g2 ]$ O/ q# G. [# @Method 02  `; z2 Z2 q; _0 [6 R2 q' c
=========( z, h4 c& ?: t7 Y5 C
! G  N$ k+ W: D4 |
Still a method very much used (perhaps the most frequent one).  It is used
/ a- p! I: A! p: |to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; e2 e% E0 Y) S$ `) G5 s
or execute SoftICE commands..." E# ?$ Z5 j3 y' {
It is also used to crash SoftICE and to force it to execute any commands
5 Q& n" W' Y* s2 p& ?) n( E(HBOOT...) :-((  1 M& i$ X3 i# P- S8 A" b7 r
1 K. S- n4 s3 }8 V
Here is a quick description:
" c! v  q% x2 |1 ^- l( l8 s$ D-AX = 0910h   (Display string in SIce windows)) B- |7 \  K+ M' p, g
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 [8 U- f  ~' D# p1 L& V$ a+ y-AX = 0912h   (Get breakpoint infos)3 V- `; _0 l' K0 [
-AX = 0913h   (Set Sice breakpoints)
* j5 m! t6 }1 T7 t2 y-AX = 0914h   (Remove SIce breakoints)" r4 x5 {& L# P  F

& r, P6 d" Z3 L; w3 h' [! p1 ^, nEach time you'll meet this trick, you'll see:- f' Y/ W) v; N4 N4 M# h
-SI = 4647h+ R5 V$ j" ]. K8 c2 M* \2 v
-DI = 4A4Dh
9 |% z' t$ t2 h  m: J2 S  m9 aWhich are the 'magic values' used by SoftIce.* P, b1 [- ]# a$ Q- `) z5 u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.! L5 s7 B- m1 ]2 r8 G

/ M& }7 s! u6 s# s' Y/ I- hHere is one example from the file "Haspinst.exe" which is the dongle HASP
: H- Z2 ?) b: x& V* MEnvelope utility use to protect DOS applications:) N8 ~0 ?7 P5 R! Y/ R" b! K! P$ H

& ?- M) ?. ?% y
1 z, N( m' U( x3 X4C19:0095   MOV    AX,0911  ; execute command.
6 i* _7 w3 g/ d% M% {3 j1 Z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., L" S$ Y7 v" D, H8 A4 q8 d; k
4C19:009A   MOV    SI,4647  ; 1st magic value.
# k2 L6 o' k. J8 x4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# O8 u3 S% s6 l  O4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% r3 E. g) Y% N' p
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
2 V! {$ E% S- W# [6 u: q' N% ~% x4C19:00A4   INC    CX
4 i8 ^. K; H. Y. a4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 j. z  q. e2 a# k9 c2 v" j1 l4C19:00A8   JB     0095     ; 6 different commands.
6 A) N) H; b% F& J5 T" I- n4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- q% r/ P1 k2 U$ M* _- v" _
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& Z5 T* f; |" t2 [4 b# R
  |0 N9 c% |$ oThe program will execute 6 different SIce commands located at ds:dx, which
' l: L  ~" ]% e% D( ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 o+ O7 c# W8 E0 P. V' r

+ w/ L( N/ K9 Y$ f9 r/ v9 s* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 @+ L' o7 O; ^" x___________________________________________________________________________" F  l& \3 V4 G. v+ K8 _

, X! a2 o; h5 s0 W& D7 {3 v- U! f* C
4 M, [, W9 [1 Y5 m/ J% {5 B6 N3 i2 NMethod 03. v& a% J: v3 I% \8 j, s. B
=========
. W) C( o. J, a+ m& f* ]9 E% v) W# X1 B
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
) d8 T* j* J0 d: f3 T+ o9 q, b; n(API Get entry point)6 [* |7 J, {+ }, U( S% F% ]. c
        ( Y3 Y. ~% m5 M2 u% ^& Q/ g) J

# a4 M1 s( j6 b% D0 n2 ~" c    xor     di,di! W* {+ A. a# x0 R. _" v9 b6 V
    mov     es,di
: Z6 M4 j" \9 R    mov     ax, 1684h       6 w# j2 _" T6 `' T1 ~1 G0 K
    mov     bx, 0202h       ; VxD ID of winice
7 ]9 r; ?5 E# D; i! n    int     2Fh. A  Y6 U9 R' p0 `$ M) [3 s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: K# v/ z: R( l. ]% S! X
    add     ax, di4 z* ?8 M  t2 R: A0 N
    test    ax,ax
/ a" P" A" y  J    jnz     SoftICE_Detected; ~: D4 p8 M# t: ?
+ P/ a0 \7 G3 w6 H! W' Y: c2 w
___________________________________________________________________________' t# q) s; ]' ], C, [& r

# j/ w& T( _/ j& E% w9 Q+ ?Method 047 b2 D& Z& \8 w, o
=========3 I+ ]4 U" ?. e, Z" o& u/ [
- X* d2 T, _6 u5 i6 T* [
Method identical to the preceding one except that it seeks the ID of SoftICE- q9 c+ S' Z) \9 ?
GFX VxD.4 c: h7 e- N- t1 ^! U9 V* b

, |, o) h4 N. g' q1 i    xor     di,di! ^- Y6 {1 c, X* b/ z
    mov     es,di) X" x% H( h- E' y# n- G0 h
    mov     ax, 1684h      
! X2 _! _' ~8 t    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ `3 P3 x+ {1 z9 ~5 ~    int     2fh
% e5 [1 o" z. E! X9 o0 `* R! n    mov     ax, es          ; ES:DI -&gt; VxD API entry point' h3 r1 r# V9 s2 n
    add     ax, di
/ N" F/ }4 J- K. j, V    test    ax,ax
' s% R3 x. X2 K6 q/ \1 y% K    jnz     SoftICE_Detected9 L& u- m2 g" d6 S. ~3 ~- {

' b3 o6 @% t+ t) K6 r__________________________________________________________________________! @! f: T- T! s' e4 Q, e
/ M- L9 X3 ~, b) D* l

: O& e7 W  ]2 h( U, hMethod 05
  }9 s- d0 X0 S; p4 s/ b0 m! X% a=========; K/ a; M& v1 k  A
/ V3 E' U( y& z3 p) |: O( m
Method seeking the 'magic number' 0F386h returned (in ax) by all system
6 r% A2 K; Z  R0 n3 `7 Hdebugger. It calls the int 41h, function 4Fh.( R: X% X$ I$ i6 H, ^3 e
There are several alternatives.  
% X' S8 Z5 l+ ~. s, \/ C% a. }" Q3 N9 ^' L" Y4 A; O
The following one is the simplest:- X: T( ]3 p! ]8 b, Q7 `7 }

1 H3 B% x. j$ s! b$ W    mov     ax,4fh
' O+ l. W7 a# ?( k: ^0 L    int     41h* X7 j% g6 y, T2 r4 k# m. I. b
    cmp     ax, 0F386, j1 x: e2 ~( O6 A; ?9 c6 z% p
    jz      SoftICE_detected
3 j8 D0 V; J0 t" l5 G4 Y" V1 y: u5 O8 G/ T/ h( |  j

7 y9 U5 _) y1 d8 w; [0 }Next method as well as the following one are 2 examples from Stone's / o+ `/ F0 ]; M" V7 o  d. q( A
"stn-wid.zip" (www.cracking.net):
5 u' @- s% V7 U# ?/ v0 ]9 M3 z( w  u6 H& O$ I" d
    mov     bx, cs0 t4 x3 t9 V, {3 V2 ~
    lea     dx, int41handler2+ H, t$ i  z) D4 k3 {$ d
    xchg    dx, es:[41h*4]9 ?; G( T* F% h+ E: Z1 C
    xchg    bx, es:[41h*4+2]
( j9 D$ s: R0 h" [4 C/ B    mov     ax,4fh- L# N; S" Q# S; H0 m
    int     41h
4 m7 j$ Y/ H. P' O' n- X6 q    xchg    dx, es:[41h*4]
( W) \( X3 @8 q& v1 l    xchg    bx, es:[41h*4+2]  W) G* G& z; u
    cmp     ax, 0f386h
7 ?" o/ w! |4 a3 O+ a( a$ `+ u. S    jz      SoftICE_detected
3 Y6 t  p' j5 u' d2 D- z. W
& W. w) I( T+ w( [9 gint41handler2 PROC
5 N% `6 V6 T6 V( B) o. [1 A    iret8 S/ M$ t) T4 a' Z- @) ~- j+ l
int41handler2 ENDP; A2 |8 H. a* d- b- s/ r

1 I( w2 W( J# h
0 Z3 {3 R' l" c& K- c- P3 m_________________________________________________________________________
5 ^- ]& _% W$ `
  i0 z, K& _: A
! D6 k, p2 l) K. ]# r7 [5 Q% @Method 06' z; T7 u, M$ U% S- Z3 P: M
=========
  o  }1 A7 q9 ~( I! Y0 U% S
2 E/ J  x1 l2 e9 D; q1 u( C7 R) I% S0 K0 p% p& u
2nd method similar to the preceding one but more difficult to detect:$ `; Z8 d1 q/ ], e3 d- g

; Q8 Z  x! P, h' {$ u* k9 x
) F0 w# Q8 _. d8 \2 O- e/ zint41handler PROC$ d. m3 D- y7 J) o& ]: g
    mov     cl,al# r5 N0 _6 z3 h
    iret
" H5 W, r% g% K% r! z: W9 k$ ^int41handler ENDP
$ P' h/ A4 H7 b: W9 Z
2 y, x' N2 A( A" ~8 e
0 _6 l8 Z8 R1 f8 v1 Y7 A* `    xor     ax,ax4 u* E# i) ?$ I
    mov     es,ax
5 E! u* v" }0 D    mov     bx, cs
$ H9 ^2 h4 ?/ Z    lea     dx, int41handler$ A  M) C, R5 P8 r4 @- }# ~) O
    xchg    dx, es:[41h*4]
8 j0 @# Q8 F% [/ G    xchg    bx, es:[41h*4+2]
) `- R2 l1 V; Q! t    in      al, 40h
* I# S7 f1 U& l    xor     cx,cx
2 Z2 I$ v" T: `0 {    int     41h
- Y4 i- z( V; B* c9 U3 C$ Q7 j    xchg    dx, es:[41h*4]
& p7 Z( \# z! g# `+ y! _    xchg    bx, es:[41h*4+2]
. @, J( p# E  S: W+ \5 T. }    cmp     cl,al3 q8 R6 {  G9 b! X: I
    jnz     SoftICE_detected
1 U8 v0 R; e$ G
) }! {  e* t, P- v_________________________________________________________________________/ m# W7 w# ~  g$ h: h7 c$ Q$ w
  c; H) |* M. `& N6 e* N
Method 07
8 C( h5 [, X& ~& z0 K=========5 w% a, ~, u1 g6 u( K, _' G0 Y
' L4 Q1 L/ n3 ?* ~
Method of detection of the WinICE handler in the int68h (V86)
! \7 o9 {8 D: |
, K7 d- R& X4 c& K    mov     ah,43h! }4 D" G" K# T( t6 L' c  i! U
    int     68h
" w% j; X' U6 D: r1 b6 _    cmp     ax,0F386h* y6 ?5 R* }4 C# U  I$ a
    jz      SoftICE_Detected
; O3 ^9 j4 v$ S. J( ?- w9 U$ u, ]7 `! [9 m+ a6 f) k) X) y: }& f* i

. j( Y  w, |% Q, p3 i& C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) Y9 P7 t9 V$ z! N" m
   app like this:6 C# \1 `- a/ }" C- K
9 R9 U) ^, \+ R' p$ {
   BPX exec_int if ax==68, ^: [" m* a, j7 }) E& p
   (function called is located at byte ptr [ebp+1Dh] and client eip is" t2 A: }$ Q. z2 p5 F
   located at [ebp+48h] for 32Bit apps)
- k4 d. Z$ D& y3 G/ |* [' V, Z) a& g__________________________________________________________________________
3 \& y4 p. t7 x
3 a3 [9 I" V; [+ O* \" W5 Z0 i7 A( v  Z2 }& F7 V" e. r) c
Method 08
9 H7 A& e$ v" \* v9 M=========6 a5 {/ e' e! ~( e- Q* W

, F4 u& C  k/ `0 VIt is not a method of detection of SoftICE but a possibility to crash the
  s+ L' x, i2 }8 l% L8 ?system by intercepting int 01h and int 03h and redirecting them to another& l# k' z- G, @. j' \
routine./ D" F  O$ k3 a" I: H
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* Z( m. s# T8 ^" U8 i" f- {
to the new routine to execute (hangs computer...)
. J, w* f, Q8 @1 [- e5 z' S4 ?& {+ v  P7 J( l$ `" [) f% N
    mov     ah, 25h! ^2 s  w* Q4 T3 F- g2 E
    mov     al, Int_Number (01h or 03h)) H- D( g( B" V- R  v, a
    mov     dx, offset New_Int_Routine
. I* h* R1 ^6 S+ ?1 l$ H    int     21h
, X4 w( ]* i  i- l& l" l  [$ b1 _5 G  S
__________________________________________________________________________
# }% J/ }' G& i' c! K1 v9 P. v8 {- l) N# [, ~8 w  i
Method 090 g+ t& s% n+ k0 g! f5 X
=========
6 w  s! I" @+ U; L
+ X& t4 [, e% l, u  n  R  wThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 ~) [! l9 q9 T1 cperformed in ring0 (VxD or a ring3 app using the VxdCall).
1 f( s) v& w) d2 u- V. NThe Get_DDB service is used to determine whether or not a VxD is installed
( z8 V% f6 P8 R( x- \for the specified device and returns a Device Description Block (in ecx) for# t9 y; l; M5 G" R
that device if it is installed.
% c7 D9 O" \# C+ e& V* ^4 c
. z8 y6 Y) e8 ^; b$ Z; ?6 @* R   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 {1 C+ q( V3 m3 ]5 Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# t, }& a7 ~) M, _   VMMCall Get_DDB, G& M  A' d* K% y* @3 j1 ~
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: S4 m" D3 ~) ?7 z) c: I; m% Z: V8 v4 k' L3 `* D( w7 a- ]
Note as well that you can easily detect this method with SoftICE:
6 J. i& m8 C3 s: M( d  ]) L   bpx Get_DDB if ax==0202 || ax==7a5fh
: }) G3 R' a; Y1 F
4 i8 h4 s% {7 ^__________________________________________________________________________
9 b6 o3 [7 E- z& S$ H! s% x2 P
Method 10
# o! `& H, F0 `=========
! o* F$ y  W4 p# C, Q% Y+ _
% R3 ]4 x) S3 _* {6 Z3 X. X4 ~4 H=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ z- V/ D5 h* D! L% A
  SoftICE while the option is enable!!' p7 l" a. l* g, h, A4 \

1 _9 f! l% C$ A! \This trick is very efficient:
/ F- V8 w% J2 M2 sby checking the Debug Registers, you can detect if SoftICE is loaded4 P! I5 P  |; \6 h8 d5 q5 w. h
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: K, q, }2 u& v+ b8 Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
  P, F8 B9 x7 G0 x% V1 G3 ^; dvalue (in ring0 only). Values can be manipulated and or changed as well8 [* ^- y- z, M! Y" O. ^
(clearing BPMs for instance)7 V6 G6 l& y( L  A" X2 O& ~
( y/ E: d! w% T4 L" [! C" p
__________________________________________________________________________
6 J5 E+ w  p. G& b  w4 K# P% K; k, N7 @& a! u
Method 11" r  U! s* l) @4 e& s+ G
=========" q# S# F7 V+ z' h
) y8 {& G$ j. u0 m. w
This method is most known as 'MeltICE' because it has been freely distributed
) c* |! C" N, e4 D0 gvia www.winfiles.com. However it was first used by NuMega people to allow4 R4 H( B+ m  N/ }( `
Symbol Loader to check if SoftICE was active or not (the code is located! `- G! Q# B7 X, I  U
inside nmtrans.dll).
4 r" J3 G$ u6 @2 _' i7 M7 ?; V5 @  R4 U: @
The way it works is very simple:/ u$ y6 b# F! o9 {3 H/ y' Y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 Q, A1 v5 D% i. K4 o! x+ w
WinNT) with the CreateFileA API.) ~" ?' ?5 A+ s4 N' r7 {% R

/ A  Z1 {- ]9 S* W3 n$ a/ f* ]Here is a sample (checking for 'SICE'):
, ^7 y! b1 k1 m3 _' A# M, e4 l$ T& R' i. ^% C
BOOL IsSoftIce95Loaded()8 ^$ l2 ^5 I& |- K$ \0 z1 I/ a
{% l8 ^! v# b0 @3 j& ]$ s9 {
   HANDLE hFile;  
, z( G  ]/ [  q# G   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," P5 v$ V" l& [- |( ]) E; k
                      FILE_SHARE_READ | FILE_SHARE_WRITE,* ], B+ e& E0 t$ _
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);9 r- _6 R5 U. A' O1 D2 O. z- V+ ~/ i
   if( hFile != INVALID_HANDLE_VALUE ): g; C5 M- G# F: q% I" c$ o, @
   {
2 G& v- E5 V1 d; d8 h$ k8 S+ F/ l6 o      CloseHandle(hFile);4 x% f2 k  {* ]. ?
      return TRUE;
8 S- ^. u1 H3 F0 ^% H) K2 t   }+ o& Y1 `/ |$ c" ?0 o
   return FALSE;" f/ T( M% q. @( m2 G
}5 z% S6 U- C  F7 N) [
4 f& A" r6 ~, N/ }
Although this trick calls the CreateFileA function, don't even expect to be
& ?& U$ @" g2 V6 ?& yable to intercept it by installing a IFS hook: it will not work, no way!5 ^2 W1 U5 h: q" M: m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 a/ r' @- J( V6 Q4 zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ s% B5 m; l( Y4 A( V, W3 }# u' sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
- S% i2 W) q" g! Ofield.
) x# s& w4 H0 S7 l1 T: V) ]In fact, its purpose is not to load/unload VxDs but only to send a
/ [- l8 |7 q0 Z5 R, R/ u6 {* r+ sW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% H% Q2 J) t9 k7 {7 D9 b& b% Q) S' M
to the VxD Control_Dispatch proc (how the hell a shareware soft could try) y' f7 {! m8 E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).& w5 c3 T! C) e: f
If the VxD is loaded, it will always clear eax and the Carry flag to allow% z9 H. [8 J  N. q$ O. z3 ~' `- `
its handle to be opened and then, will be detected.9 T& m" ~% B/ {( a, {
You can check that simply by hooking Winice.exe control proc entry point
! d* b7 e( Y" g, g; V  Q6 q% ~while running MeltICE.' H4 U( f$ @* I* f$ q8 e

0 `9 v5 _( u8 w7 r6 m/ _
: n  H1 H7 s( Q- `  00401067:  push      00402025    ; \\.\SICE
3 h4 f. Y) Z# T% b  0040106C:  call      CreateFileA/ k& l! O6 C6 r5 a- C6 V' \- r
  00401071:  cmp       eax,-001$ z7 g+ C$ w" T4 r' A& ^$ D( _
  00401074:  je        00401091% [' v7 q2 V" l. B

2 D& y7 ^, H; k2 X3 V) m/ m/ \! }9 y) h1 Q7 n
There could be hundreds of BPX you could use to detect this trick." Z/ F$ A4 ]- g" p  Q  Q
-The most classical one is:
1 E/ ]) P% t  u& j5 W) {$ S& Q  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 f. e# R0 A2 S    *(esp-&gt;4+4)=='NTIC'5 ]( J5 v2 F) X5 n. d  k

# C. @5 S2 X* n5 G1 ~" r7 `-The most exotic ones (could be very slooooow :-(
% V8 g5 x( C( A4 Y7 X/ E- o   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . [7 x- d! A* S! @' H- u: K
     ;will break 3 times :-(
0 M& ]: C. L. T( H( ~8 v$ J& I8 g7 B/ a
-or (a bit) faster: & [5 J, b& {, I/ \$ g
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 Y9 j4 K+ j& O. |

# {+ \2 T' R+ M3 N% f   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" Z# d1 G7 W9 A/ S2 U- c     ;will break 3 times :-(& B, j* ^7 h* E. E
0 T: ~8 G9 h! F; h; K
-Much faster:
4 Z/ V; N/ V; h- Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'* P* e% N. a* g7 {
; G, {2 z  o( A' T: W# \" [/ m
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 z8 G9 g2 T  l$ T* c: Y
function to do the same job:
5 M6 q! b3 D& e4 H' h- U7 W: S
. m! W1 ?: @% m( {/ W) B' L0 L$ d   push    00                        ; OF_READ6 S- N" C0 H  h3 l9 R, s
   mov     eax,[00656634]            ; '\\.\SICE',0
8 O9 q$ B: Y7 X& q   push    eax2 D7 H8 S/ g% I% l. I
   call    KERNEL32!_lopen
! g  P+ `" u; V, `; C! r   inc     eax
6 D4 S+ X+ ~0 a" T   jnz     00650589                  ; detected+ ?, a2 Y7 X0 l4 u! `
   push    00                        ; OF_READ4 f% q  F% n- V0 K0 X- y
   mov     eax,[00656638]            ; '\\.\SICE'
; J4 w( X3 l9 l   push    eax
: d# u; ?2 ~/ p& W7 b   call    KERNEL32!_lopen
& |1 y' d" l7 X0 J: i4 w) [" O/ H   inc     eax
& q8 j- V6 p9 {" w; b2 Q   jz      006505ae                  ; not detected; b+ [5 ^1 x3 T! Q. C% t5 \
' W8 R+ ?. t# p$ Y& }: E0 A: o( R

( O6 \7 L) F1 G! N! }1 @__________________________________________________________________________
8 x8 a3 X" |* {3 I  p  Y+ |% s: Q2 l6 D3 O3 C6 ?( Q+ F
Method 120 v; V3 M$ i9 w3 `  z2 a
=========
* w0 ?$ n/ f+ o0 d: h
- Y4 b1 ]2 j8 t  _( U* u1 NThis trick is similar to int41h/4fh Debugger installation check (code 05
. O- p' C, p: ]4 O2 l& J  @9 d, E6 R- y&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 I3 l, \: L$ O- F
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
/ T) ^6 Q3 [  }( i' m2 v$ L* @, A/ B$ \2 k( `0 U3 a
   push  0000004fh         ; function 4fh0 t+ I; t1 K, }
   push  002a002ah         ; high word specifies which VxD (VWIN32)$ w, R- e, ^* h
                           ; low word specifies which service7 U2 {+ \) h5 a! m5 p
                             (VWIN32_Int41Dispatch)
9 K, P3 U; |# [8 D# d   call  Kernel32!ORD_001  ; VxdCall
: N# _2 E5 ]8 L% P; Z$ V$ @   cmp   ax, 0f386h        ; magic number returned by system debuggers: `  D  f5 ~# E
   jz    SoftICE_detected
* D1 J9 V. I$ p1 y2 L* B. ]7 ~2 G% B
Here again, several ways to detect it:  A$ D( c& h# h8 R
+ `+ l) @+ @+ N
    BPINT 41 if ax==4f# `9 r. l( }5 z

$ }. W3 d: t$ i- w: k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  e/ K; c; U9 L5 v$ M8 O: Z( C+ m* f6 ]5 ?! e. e3 o& E6 J% `
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 b- p( y! q. s( K' `; h& J4 s1 {- b) n
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 E( e4 u5 w3 Y2 H& U+ \0 u! I2 j5 J4 p- J# K$ r  G0 k
__________________________________________________________________________0 s  c' L( h8 r/ q

- F: s0 K+ K6 e8 {6 BMethod 136 J' X$ z3 Z" E2 g! C. O! \" O
=========7 V" h  P2 f) Y0 E
4 N- ^4 B2 u3 S* u8 r# N
Not a real method of detection, but a good way to know if SoftICE is$ c/ J. x; @0 O- {- R( V- Z
installed on a computer and to locate its installation directory., U7 B+ Y+ l* a! x8 l1 M- s
It is used by few softs which access the following registry keys (usually #2) :4 h" T! t+ l. i2 \4 d6 d
6 w5 l- i( E( E; g5 n/ |4 t5 w' n
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ b( o0 N( `7 D" S% j5 W+ [; h\Uninstall\SoftICE
* x! ^2 W3 J/ p- u-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; M3 ?2 D+ x- ~& |0 X
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' x$ I( q4 j- K: w3 {\App Paths\Loader32.Exe
/ i9 H1 W4 B; F: I$ H: P9 B$ S3 O3 G

- f" P( f3 B+ I* \) f+ GNote that some nasty apps could then erase all files from SoftICE directory) M7 L" F& t+ y0 ~* ?+ @1 w
(I faced that once :-(6 a- u( S* J' L8 y2 g; r8 C! }
9 U& O3 s) I. {1 ~8 E
Useful breakpoint to detect it:
2 s7 w$ C7 ?9 i- _
# \+ ]$ [2 U8 X     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'8 q" m/ T' f. k) P% `

& [! P0 N- X& q8 r__________________________________________________________________________% \. @& ?8 D# i
9 w2 ]8 W  l0 ?* l" P8 D: O2 ?
) c$ }9 l/ s9 I) h0 v. E+ f/ E4 e
Method 14 9 B  L5 p8 q7 K( b
=========
) x9 x% ]4 P8 p6 g# [+ h
$ d. I% y) N- O3 w/ r$ J  lA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" s5 K3 L: [/ F+ b6 Z# L, q! J4 g
is to determines whether a debugger is running on your system (ring0 only).
: x% a% g# y. H' j* S" u+ K' R3 u! ~9 K* m, s$ I4 I. ~! o: t
   VMMCall Test_Debug_Installed1 L3 ^# V/ L6 W" w
   je      not_installed/ ^7 x5 X3 N% a) X+ p1 |

: ]2 L$ V* R* w3 V4 N; UThis service just checks a flag.
+ `+ \! I" ^7 n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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