About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
6 U5 d; K/ `7 T: h& |! _* ~2 s( q<TBODY>
/ ~( W& a0 ]! W* P6 e# b! v  y<TR>( e: S. i# \# x+ ~5 k! @
<TD><PRE>Method 01
% ^( E  [: o$ I8 K0 J: j=========
$ R+ v" Y' a4 j0 h* M* r! U8 i
" ^" O7 }) Q0 b6 ~5 X; zThis method of detection of SoftICE (as well as the following one) is+ X- F* d1 ]0 g$ Y# K
used by the majority of packers/encryptors found on Internet.
# F; t) V: l7 h6 MIt seeks the signature of BoundsChecker in SoftICE( }; p( s5 o+ g
! A  Q9 Y& b6 z- q6 b1 T% K
    mov     ebp, 04243484Bh        ; 'BCHK'1 u* E6 y2 G* Q% x7 @& }- ]
    mov     ax, 04h( T- L$ u9 L; Y6 J
    int     3       6 C& e# Z) C% g5 r/ Y- K! X
    cmp     al,4
) H) R, b+ v) t: q    jnz     SoftICE_Detected/ B& X) D. B* o/ n9 t# M9 G4 {

2 y% T2 X% M$ E3 [' J0 Q___________________________________________________________________________
& m' A8 A$ [; h9 v; H, i/ [1 ?& |: ~6 Q7 F6 T' v
Method 02$ x( j1 X% a1 K( u( i' d
=========+ E6 H9 F+ U6 m6 H; U

/ i1 c8 ?; |) o9 _Still a method very much used (perhaps the most frequent one).  It is used
. s+ Q# l2 W% Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,& T% j* o  c+ w; c# D
or execute SoftICE commands...
7 ^1 Z4 A: Y/ x0 ^It is also used to crash SoftICE and to force it to execute any commands
% C) c9 k# c: b2 I  {(HBOOT...) :-((  
, I) i1 ?* w5 E% n9 T, }: j- c0 ?2 q" i: t  E0 U  Y
Here is a quick description:" R( j9 x, A  v, C! i; q1 M
-AX = 0910h   (Display string in SIce windows)) t1 a+ g0 ~5 ~5 f, w/ k
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx), _5 Z0 r- e$ O- n+ y
-AX = 0912h   (Get breakpoint infos)
1 H! V# f  E: m$ i-AX = 0913h   (Set Sice breakpoints)# t& z9 _; I, {* A% A* e
-AX = 0914h   (Remove SIce breakoints)
( c9 I( C! p4 M( J0 i9 W$ u, h2 @! @
Each time you'll meet this trick, you'll see:" @# Y. `/ p& a# |' h
-SI = 4647h
- G5 S5 V3 V7 [( s: p-DI = 4A4Dh) L8 o- o9 C, R  V7 z/ f1 `, f: v
Which are the 'magic values' used by SoftIce.
2 |9 P# ^( W0 W6 ZFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ J$ g3 F% ?) K, }
& r% x' n; W3 y. i6 ZHere is one example from the file "Haspinst.exe" which is the dongle HASP
% n  ~7 }  r: f5 i; REnvelope utility use to protect DOS applications:
' C/ M2 A1 E% }- C9 C. ?! _/ N+ B3 V1 J6 m! M2 V
1 G9 ^% l9 J7 q
4C19:0095   MOV    AX,0911  ; execute command.
4 j9 h8 i6 w: L, H' D' b5 e1 [4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 u) ^# l0 F0 B/ c4C19:009A   MOV    SI,4647  ; 1st magic value.) Y$ [. N/ ^2 M7 v% r# {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.' s: S" n8 j$ }) @
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
# z8 d2 X" r  O8 @: y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' R0 H+ D$ _2 P* H4C19:00A4   INC    CX3 d9 w! V6 `9 W& L  _/ f
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
$ C; x4 N: g5 M) g2 n" N4C19:00A8   JB     0095     ; 6 different commands.
- f5 ^, `$ f, c# `9 F. U6 k4 Z) c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! G; y' s' r+ T3 v% T* B2 k4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# L- L7 Q9 e2 L$ p2 q
/ ?( y! b6 c: H$ e0 HThe program will execute 6 different SIce commands located at ds:dx, which
) u: l  s! a- |% N$ dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: w0 V- ~) |- m2 C) c- W2 L* [1 P( E' c( z2 k
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ q8 A* m  N4 j8 U- v. o___________________________________________________________________________8 ?. K3 a7 q8 h! J" D

7 I6 H5 T. S/ m5 U+ T
+ i. W7 P$ X4 T6 O7 i: w, L7 aMethod 03
+ r* X( W3 N! f8 N3 N/ ]* `=========
0 ?0 E# r9 N7 E$ c! k) Q" |& g
6 Y" F' N  ?* i9 b7 G9 a# s6 NLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 _- x% {: R; x7 T/ s1 \+ {(API Get entry point): }! R/ v- c" O7 T" b" d! s9 N
        # }7 p( C1 a/ j5 \" k) c8 k

; q4 y; p; p7 q2 X5 }( y1 E- J    xor     di,di$ @% b1 K9 K$ e
    mov     es,di& o, [& l  i6 x6 G
    mov     ax, 1684h      
! a! M6 N2 P, M    mov     bx, 0202h       ; VxD ID of winice8 G3 \% w+ Y: g
    int     2Fh
) \. H/ W  G' H3 B+ v    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 c& Y- |8 ?0 g" U
    add     ax, di7 D0 t( t5 ^" W7 j, E
    test    ax,ax- O# G, L, H; b. u/ S
    jnz     SoftICE_Detected
, p- K: X- R% M/ K
; f7 n! w5 ~0 ^0 Z0 g___________________________________________________________________________" Q8 o/ c( x7 ^% G3 X- B

) @# P! f( H4 |Method 04: w! z- l) l8 G: _) t) A0 x8 ^
=========3 W$ V7 Q2 @  G' [- T  J

. y- K" R4 l. L( aMethod identical to the preceding one except that it seeks the ID of SoftICE
- V: t6 s6 t3 u% CGFX VxD.
# G) ?# {! i- W- ^* l  v) v7 ?" e0 ~- C$ y; p. w! u
    xor     di,di' T8 |0 y, t2 ]& e% ?! {8 S! T
    mov     es,di
" n; o8 ]6 O" C9 s    mov     ax, 1684h      
3 O) [% d% H& |/ \; i    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 J0 Y# K9 ^1 H. S5 d: d7 t: e    int     2fh$ n  G3 Y4 J/ l- R! A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point: L" U2 w; C: ]6 |6 S( V4 q4 B# T
    add     ax, di
! X* ~0 @( N. w2 d3 t    test    ax,ax
- m/ `9 u- W1 S    jnz     SoftICE_Detected: `6 |9 f6 G$ U8 v+ _6 q
1 |5 }0 L) D  F: ~- O$ T
__________________________________________________________________________( x) \) l" i5 d
- U7 G5 E0 D* c) O3 L

: t9 N. S! U- x, p5 SMethod 050 T1 s9 Z. p2 z* }! w. P
=========
2 w# a4 G( ^2 W. M. d0 v( z4 A
5 ?. w9 c3 N* \/ M3 Q2 SMethod seeking the 'magic number' 0F386h returned (in ax) by all system
- e% X: X% R* t) jdebugger. It calls the int 41h, function 4Fh., M' ~6 X7 M: m" ?' W& X
There are several alternatives.  ! U, a& z, W3 t, R

9 m$ T, U9 s8 @+ Y, mThe following one is the simplest:+ `6 H" K1 g+ x
/ D! C2 u. Q( }  a+ w+ D- {. z
    mov     ax,4fh
. F! `. Z7 @, [0 a$ g  O    int     41h
7 H% \: u0 t: _& m( t; \. t    cmp     ax, 0F386
# V+ b# B) t) V; ^    jz      SoftICE_detected% s2 u% {7 X+ \8 n8 |4 [9 s

. N% H( Z2 v  ?# j% L8 X- z6 c7 c- @' ]
+ x, q) j- v) i5 S6 `1 fNext method as well as the following one are 2 examples from Stone's
" P& g- }+ K5 J! H" z"stn-wid.zip" (www.cracking.net):
6 t) p5 E0 F; U7 i. Y3 d5 i9 [& t9 ^, l
    mov     bx, cs4 u8 S+ `7 M' e4 ]* G8 E
    lea     dx, int41handler25 w, F" Q0 v4 }' \4 f% U. s
    xchg    dx, es:[41h*4]
$ {3 G$ v% c: m$ _1 U% U    xchg    bx, es:[41h*4+2]6 q7 B4 Q& R* ?
    mov     ax,4fh) r7 z) h: y# G5 w. Z
    int     41h
8 y  W! ^4 [1 E3 N9 ]7 J    xchg    dx, es:[41h*4]
* m; F4 p2 ?, W" x4 @' u3 G    xchg    bx, es:[41h*4+2]
& C1 k) D0 m4 D- c7 f, ^' Q    cmp     ax, 0f386h  m) g2 P2 R0 c$ f: u( O0 ~
    jz      SoftICE_detected/ c* k1 s% l! H3 C9 O6 H

% {2 s8 K8 o. r& h( ]int41handler2 PROC
8 g6 O0 T/ i/ }0 \  Y& h( K% q    iret
! E' Z$ ?2 m, P' mint41handler2 ENDP
. m6 l7 i. b5 u9 v3 _4 J3 q2 g' @* S  L+ Z) C& e! K. e4 n9 ~

8 L5 J7 e9 b0 n1 V7 A, k+ [) {0 E3 n_________________________________________________________________________! A) m4 V7 Z! I. G, o, o- }6 N

; i9 X" U% Y, Y3 X' k! s# S  Q( |- r: L! g
Method 06
; w, k3 u) U) S=========
, H1 k3 b2 ^, b$ z5 _. R  y4 _3 o- A

; i5 Y6 ~1 H, I# z& y$ W  O) W5 \' v2nd method similar to the preceding one but more difficult to detect:
. |* C" |4 I3 J/ r* f0 S
, m4 B( D1 q' w+ {9 j4 N; {% ^0 y1 {; p8 M( C2 ?: Z6 u% y
int41handler PROC
, {2 ~0 ]3 L3 ], [    mov     cl,al  m  E9 L0 k/ ]" `4 U
    iret
9 ?, M- A) D! {  n4 k. Cint41handler ENDP. ?' f! F% ?  U& E- A3 O7 T) r% `1 Q
# l8 X$ ~8 E0 @0 q
, O& g' P) `4 O8 m3 B# O/ Q1 J
    xor     ax,ax% A% f9 [# f# d# c7 J4 t, F) n: |
    mov     es,ax
$ U6 Q) i/ h, a    mov     bx, cs
- V0 C% O7 R, E- L5 s. A) D8 i; n    lea     dx, int41handler9 C7 I% p# a2 ~6 k
    xchg    dx, es:[41h*4]
$ B3 s6 X: }1 q$ s4 @! z    xchg    bx, es:[41h*4+2]
- U; |$ j/ U9 e! S8 }    in      al, 40h
) N* T: g2 v& u7 Y, h+ t6 o! Z    xor     cx,cx! N/ E* H/ H6 z
    int     41h4 [. H8 g9 ?  _& ~3 x+ Q& j; n
    xchg    dx, es:[41h*4]4 [; C8 M9 I) Q& Q  `: ~' M6 F
    xchg    bx, es:[41h*4+2]
* C3 _9 U3 [1 D    cmp     cl,al$ v0 }0 d: B2 `' `0 m% @6 |
    jnz     SoftICE_detected
  R/ y. i2 Z+ z' C! N$ R: k0 }' a4 i" l' r; u7 `
_________________________________________________________________________8 g) P* \3 B$ n% i) p

; R& G. S9 `4 c% b7 \4 }1 L" j, KMethod 07
3 c. ]/ w5 C- f: p: M$ O8 n0 n7 t=========
* g; c0 x1 i* y8 \) w. k+ J; ^
7 R0 C6 O5 |  n( ]( |Method of detection of the WinICE handler in the int68h (V86)0 T2 w  u2 `, _

: B( e: J( c4 U1 f; M    mov     ah,43h' V* N8 c% C, a$ r; {* ]
    int     68h7 |. I5 Q% Q& c
    cmp     ax,0F386h0 y( L9 u+ U2 z+ i3 t
    jz      SoftICE_Detected
% u! p! |: c: Y$ Q+ b" s4 C
" d0 S7 b3 Z8 D1 Q6 w
1 L+ p2 V( f/ y, ]/ Y( V" A=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- ^! _9 U) Y- X6 B1 K
   app like this:8 R+ S% M; {% r. n
: n* l6 O# s/ M/ i" H- K
   BPX exec_int if ax==68, i- k# [3 l9 H- _& }
   (function called is located at byte ptr [ebp+1Dh] and client eip is3 W: o; W* f- `5 R9 Z
   located at [ebp+48h] for 32Bit apps)
: K+ T7 R. q' j" [4 O2 A- b9 S! k7 b__________________________________________________________________________
" T1 |/ Q4 s- F' R& _' C2 j
7 p; M2 _3 t: i" R/ z9 u* k& }' f4 Y' j6 u& Y; v2 B2 E) j
Method 089 y% p) q7 e4 |; R' e# Q
=========7 c2 b/ e. x* d

1 z) g" K# v" K- JIt is not a method of detection of SoftICE but a possibility to crash the9 Q1 `' C: |( h2 [
system by intercepting int 01h and int 03h and redirecting them to another
5 p$ p1 Q2 a+ L* Vroutine.
% R- O4 y" f/ k. R: XIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points4 t! h( k) b! H5 A0 l* C
to the new routine to execute (hangs computer...)
1 i* r$ }3 l2 e7 g
8 L6 m% W6 J, _3 Q2 ^0 R  ]    mov     ah, 25h! z' o4 w% {3 t
    mov     al, Int_Number (01h or 03h)! J- |4 [6 R' {' i6 H( P" E. e
    mov     dx, offset New_Int_Routine
' m0 S( h' t: t. O    int     21h
  Y8 J& u* x, A
8 u3 H7 \! f- s' b; t__________________________________________________________________________% q6 I2 b! [8 |7 C  F9 `/ o
' x2 p1 n/ B0 g% _
Method 09
7 o1 q3 ~0 ], u# X+ s+ Y% \=========
7 E# v" N6 B( d  F( C
* c; V/ G1 O$ k. b6 xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
( Q7 [" l* d! Dperformed in ring0 (VxD or a ring3 app using the VxdCall).
4 a/ K+ _# d4 T- B& ]The Get_DDB service is used to determine whether or not a VxD is installed
+ g; P1 m; ~* ^  z/ a; J' s: {for the specified device and returns a Device Description Block (in ecx) for
0 j: O7 Q' \- u& g- \that device if it is installed.1 n0 [+ F! l8 p: y$ U; r) c; c

/ C7 P2 B& N4 G. i" L   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; w: s6 B! H( ^" K5 V- s
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 r4 R  U, U/ V5 F
   VMMCall Get_DDB
8 W. ?! p) G5 |( G1 }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, s. b1 Z' u6 a0 ]  M$ @% J: s- N4 F! B; v+ A" K
Note as well that you can easily detect this method with SoftICE:
/ I; B' Z  V. [' e: m% e) X   bpx Get_DDB if ax==0202 || ax==7a5fh+ l, w% P. T; `  c
' M9 t9 U- k' W% N1 B0 u
__________________________________________________________________________
7 h, l1 v  S9 d) H5 R/ X4 _5 |1 a# b7 f' D. u
Method 10& b$ _1 o* y0 R& J3 T
=========9 S2 Y3 l( r' Q
- d5 k  l/ I5 Q: n& c! I; a5 X4 K$ K
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 k/ Y! O  K' ?8 s- n  SoftICE while the option is enable!!
1 K7 S0 ~' D; o7 e' o( Z) w6 s6 E; ]6 t' b1 v6 E  G* r
This trick is very efficient:
* Q0 f% t6 c$ Q* I9 u1 E5 Jby checking the Debug Registers, you can detect if SoftICE is loaded8 L  @1 {( K+ A& p% U
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
  o; `: x7 b2 sthere are some memory breakpoints set (dr0 to dr3) simply by reading their8 z! N, |' Z8 `1 M! Y9 B, B) N3 y, a
value (in ring0 only). Values can be manipulated and or changed as well
$ I* s' d( v0 E4 U# i0 L) ](clearing BPMs for instance)
% X5 f" D- e" {5 T4 X) X0 x* J$ s* l7 k) F, _1 w
__________________________________________________________________________* A1 U/ V  J* }# H9 H' \  P
2 i* L  g8 n: B9 ^
Method 11# j& [: v9 r9 K
=========
& ?4 g* t) H* r* `
, h' _9 [4 Y$ |: G+ h+ UThis method is most known as 'MeltICE' because it has been freely distributed
0 G" P- e) J0 L4 R5 S0 qvia www.winfiles.com. However it was first used by NuMega people to allow! t4 P9 ]0 }; h6 V4 o
Symbol Loader to check if SoftICE was active or not (the code is located2 g$ {. c/ f3 @8 _
inside nmtrans.dll)., W% m+ n) [- J. X# @' |; W1 v
# v* F$ d+ ]; Q: O6 a4 y+ k- [
The way it works is very simple:
; J, u7 F; P, w" uIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 c' M6 N# X8 Q5 L9 v. N! X! H9 e
WinNT) with the CreateFileA API.
! _% A, @; l- k+ \' k( x$ d+ n  `6 w* T  F* w0 w) m
Here is a sample (checking for 'SICE'):# `* N4 {9 S0 o3 Z/ O4 F
& l2 d$ M8 J# H! Q) X
BOOL IsSoftIce95Loaded()" ^& o2 W/ G7 v% [
{6 t, \% O' i; v! W- g
   HANDLE hFile;  ( |- m) i. Z+ ~! s4 a+ W
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( ]7 [8 m: ~9 t! h- n2 I7 f                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, K( Y5 b) H1 M                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);- T/ V  _% r4 _
   if( hFile != INVALID_HANDLE_VALUE )
  i" E- e. `! n1 i   {
2 P9 t# S3 Y3 Q6 d* j/ t      CloseHandle(hFile);
" x8 B, Q( {: r; V: Q: K2 [      return TRUE;+ W+ O" b0 N1 {8 X0 G' o- x+ R
   }/ j8 [4 l; ]4 ~7 b& f& `7 o
   return FALSE;) L2 x3 Q3 d$ B5 Q# m
}
+ G* R* x5 I4 \* Z
. d, U1 U9 Z" a: ^6 LAlthough this trick calls the CreateFileA function, don't even expect to be
0 J4 m& C5 l# I8 c, aable to intercept it by installing a IFS hook: it will not work, no way!9 L* v! M& i$ W, I2 I
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 z  y- K& Q% e% xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 B8 E) B9 ^3 X3 Y  K) rand then browse the DDB list until it find the VxD and its DDB_Control_Proc
/ ~9 k: _: ?, W" X" xfield.# k$ v' m+ O+ \% u0 F- f9 }+ K
In fact, its purpose is not to load/unload VxDs but only to send a
8 ^$ |! `; K" F4 i6 {$ pW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ x0 F; E. x" L
to the VxD Control_Dispatch proc (how the hell a shareware soft could try3 h# |! P& y3 m. p3 G
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& ^4 [) O" Z7 a0 u3 pIf the VxD is loaded, it will always clear eax and the Carry flag to allow
7 Q8 p, N6 Q* D$ dits handle to be opened and then, will be detected.
, i6 b. J5 g, k+ wYou can check that simply by hooking Winice.exe control proc entry point: V8 c6 F. s" T. q5 P7 T- Z( V/ o# X
while running MeltICE." \* ~: i- Y6 l) v# c6 R

$ z; ?/ M/ f0 j! D& L6 A9 D- A
2 i, s/ N  _. w  J  00401067:  push      00402025    ; \\.\SICE
8 g( _/ V, B5 R3 A. A- \  0040106C:  call      CreateFileA5 _) Y1 s. v" n4 G# R$ Y1 p
  00401071:  cmp       eax,-001
$ |6 t+ ]- t% n% U  00401074:  je        00401091: K" @& J- s  x; X
5 \$ ?  s' Z* ?( N+ p( b  m6 Y

7 T& ]) S) C  Y1 MThere could be hundreds of BPX you could use to detect this trick.4 F9 C2 Z* A% H. a: x6 N" K, j0 K
-The most classical one is:
- r/ ]9 B& M0 _4 J' e7 G0 ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' R- s$ p' z' _    *(esp-&gt;4+4)=='NTIC'2 }" j& y+ _: W, x

1 E( ~3 l5 c5 S/ q6 Z# o' L0 X+ v-The most exotic ones (could be very slooooow :-(- [: v, K) p9 Q8 y$ X0 ~, _7 {
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  R7 ]( J- [4 G     ;will break 3 times :-(3 k  z7 O' E% k5 n# g. ^
4 J: o: P+ I: m) x* n" W
-or (a bit) faster:
) W% \5 s0 C6 d  `   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 q9 b* R6 ~* z! V1 Y% M

$ y$ z9 _% p) `- v2 S5 K0 b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; o3 h! v" k! h/ P! S5 h" z
     ;will break 3 times :-(
1 L5 e- K2 Y( C' \+ J( I# B8 I8 [$ u2 J' p( j
-Much faster:) Z9 L/ x4 s5 h& H4 g6 ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 r+ S, u) a# g. x% G+ H4 ~# X, H0 I! e6 S3 x7 F/ [; _3 ]
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
" L0 A4 l9 x8 Z% o  }5 Xfunction to do the same job:: `/ s% L. D1 L$ l$ ?9 v/ [
0 c) f; L  q; `( Q+ T" u
   push    00                        ; OF_READ4 J8 E' ~# O8 L
   mov     eax,[00656634]            ; '\\.\SICE',0
4 n) i$ M, M  W$ d8 _( u! S$ f9 R   push    eax$ G; q/ \6 x4 y  ?) ~0 u- l; K
   call    KERNEL32!_lopen. N; x6 c; V* l9 G
   inc     eax
+ _! f" Y1 v4 i6 [* w. u( w   jnz     00650589                  ; detected
' G( P- D; a: `# A; z2 p   push    00                        ; OF_READ
4 Q& f2 j' \! H2 ~9 }+ f   mov     eax,[00656638]            ; '\\.\SICE'
# q& k, O7 d/ c2 C8 }% L  D1 W   push    eax5 ~  u0 `& d6 f) A- S: E! B
   call    KERNEL32!_lopen
2 V$ E$ E) N; y8 L" e5 k   inc     eax
. Q$ i5 r2 d/ x- R   jz      006505ae                  ; not detected
* D( F; m* B" x0 X/ k! T8 g
6 W7 R0 t% H+ K5 G4 l1 h0 p& z; B1 J+ e7 S
__________________________________________________________________________
! _( a1 q6 U; b% t; @+ b0 i5 ^
0 `+ o/ D( p  D* MMethod 12
' N3 T' n  Z$ F5 f0 D# |( U1 L=========
7 n) b8 G- l/ p  l9 H% ?3 H
4 ^$ J3 S3 Y- Q3 w0 FThis trick is similar to int41h/4fh Debugger installation check (code 05" L( ]( \4 }1 u
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 d- o4 I& A/ n/ h2 w2 c, Gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 L9 j8 e3 U& L9 r: C3 y9 @# r' V
+ K. u5 X% F0 ~3 \   push  0000004fh         ; function 4fh
7 _0 Q0 o/ z+ o# F: f2 ?6 H   push  002a002ah         ; high word specifies which VxD (VWIN32)8 r; n4 L$ J& r7 P" Y
                           ; low word specifies which service0 W0 h; I% Z8 `  }8 \  A! Z& a6 V
                             (VWIN32_Int41Dispatch)
" E2 h; }6 P! E/ _# |   call  Kernel32!ORD_001  ; VxdCall. z  Q: `, I; x- e9 F9 G+ h
   cmp   ax, 0f386h        ; magic number returned by system debuggers
; p5 h5 ^( A- [& ]1 C; s* r* j   jz    SoftICE_detected
, Z' T" {* f. [+ A4 ^/ F' \
- K, F3 r( f) |! |2 i; GHere again, several ways to detect it:
- e8 f6 M6 ~' R7 w: \  @$ I% o5 k/ y
    BPINT 41 if ax==4f9 \0 v% q& Y( ]9 `; g9 v

8 X7 n$ y5 |4 a, p4 U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
% [8 ]0 @1 C, y
# M8 q0 A$ s& r6 |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: K' O: z5 F4 S/ r+ b5 ?# ~7 k+ T! ^) d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 o$ O$ [' ~* z& P  x5 U8 _. l) s

& n/ \# d; q( G! z  {5 V% O__________________________________________________________________________$ a; r5 i: n/ |4 {# u6 J6 Z1 L

, d4 f: K* Q% b6 bMethod 133 X0 y/ m; B4 T) ]3 D# q
=========
/ `) r! j+ z; I/ o8 z' U8 \2 l7 N3 Q9 u7 l% a5 @' |/ e6 m
Not a real method of detection, but a good way to know if SoftICE is8 M$ l" s/ N: E( @# z
installed on a computer and to locate its installation directory.( L! n9 K( c; \" |* _, K
It is used by few softs which access the following registry keys (usually #2) :
# r% F8 L( i7 y: [! b
# a% w% y) i  E" c' n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; r" c& t6 K) e0 P3 f& K\Uninstall\SoftICE
. O- I/ a- s' ^5 V! x4 }4 D-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 e. Q7 |+ r. m' |-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) [# q) x4 U; z$ s: r9 p
\App Paths\Loader32.Exe; m# V" j: B* e  y
' l/ C1 v$ C2 n$ v- _
. k! E4 v! @6 K$ ~7 L
Note that some nasty apps could then erase all files from SoftICE directory$ H( N9 c$ I$ J. ]$ f* R  @0 r
(I faced that once :-(
* D+ z" Q! Q2 C: i8 N* l: e: i! ^4 M. O8 H, _& b
Useful breakpoint to detect it:
5 }# K- q9 g# Y/ A9 M# Z& y6 M$ L: }1 w" k8 B, A5 [# z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
) s" T2 v% k1 `* z6 c( D
: F3 q  N* f/ j* A8 x__________________________________________________________________________
5 U8 Z' I  i. Z; C, o% r8 q- ?; y4 j6 {0 {; e& a

6 A* ]7 P, h4 VMethod 14
" C! f5 `0 j% H& ^  M=========' ]6 ]1 N$ j/ y5 j

; [' {. t6 u9 Z" v  X8 hA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose7 b) P( ]& y6 a& o4 Q' N
is to determines whether a debugger is running on your system (ring0 only).7 e6 _( y$ l( A+ k: W

5 F; A# c- I& U! c. ~7 ?2 l   VMMCall Test_Debug_Installed2 Y( K7 W8 b! B) r0 V
   je      not_installed
; U! G1 c! [: y; h5 e- u5 w* H2 ~
: a: P. ^) o! w$ k- g+ LThis service just checks a flag.
$ y, F6 D0 n5 V+ z/ Y7 K</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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