About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) d8 J  @8 V7 g2 p
<TBODY>1 |, z& p2 X$ ^# t# {- V
<TR>6 V! `4 B9 w+ z% D
<TD><PRE>Method 01
8 O6 p% [0 v4 T4 j=========
; v& q$ \. w: J' Z+ P- q- X- M% L. r7 f1 z* d/ H
This method of detection of SoftICE (as well as the following one) is
2 ^- N* I+ U- j4 `5 @0 sused by the majority of packers/encryptors found on Internet.- j$ \: |8 z8 }7 D& K
It seeks the signature of BoundsChecker in SoftICE
! H- M3 ?# R) V8 x$ Y( X8 y5 h8 K  F$ U0 M
    mov     ebp, 04243484Bh        ; 'BCHK'
6 b9 u% e& J0 w% n* ?+ _    mov     ax, 04h
* h/ T# z( Z3 b& h3 F6 N' N8 s; P    int     3       , ~1 @# g$ V) `. p
    cmp     al,4. `/ j5 ~: O4 s1 h
    jnz     SoftICE_Detected
# `- w' x3 O- D) Y  |4 {6 q6 |- a! r' I/ c' }
___________________________________________________________________________  K: a5 a( b. L! G4 w: `9 D+ v
4 s. ]1 w+ P5 D/ Q
Method 02
6 `' O! ?. z! x* |=========
8 C/ J0 A0 A' _% f( u
3 j7 N* ~9 F2 q+ z8 r5 @1 d- kStill a method very much used (perhaps the most frequent one).  It is used
+ o% j2 Z& Q/ N* d7 t& Eto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 Z+ z4 N" X# ?3 H" K( }* W8 jor execute SoftICE commands...  }# c* O0 [& ]6 }! ~7 L  z& j
It is also used to crash SoftICE and to force it to execute any commands
6 h$ l# d8 H6 x# [) I(HBOOT...) :-((  
9 i$ U* G8 {* Y. n/ @! e
9 J5 ~, B* h6 Z" \  y* rHere is a quick description:
2 P/ U8 `7 K7 @1 P' J' `, e! {2 d, F-AX = 0910h   (Display string in SIce windows)7 Y) v! I- H" z% G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# L5 C. l1 {! [-AX = 0912h   (Get breakpoint infos)8 T" d- N3 I" {, L* f
-AX = 0913h   (Set Sice breakpoints)
7 v4 ]) H$ e3 K, E  d2 M-AX = 0914h   (Remove SIce breakoints)
+ H# @+ V; @& L3 d# W  \$ m) q2 I% E1 i: c1 J$ h* z9 Z  `
Each time you'll meet this trick, you'll see:: A& a3 M: |. U3 f7 |
-SI = 4647h
) r5 g" ~  n2 |: g" ?-DI = 4A4Dh8 ]2 ^5 I+ s! n' a9 p9 y, v
Which are the 'magic values' used by SoftIce.
1 x, n1 w5 s$ S6 O) ZFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.# c6 ^; a6 k9 U: ^
9 n) {- Z$ U! A
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 K) o, ], l9 T2 W  B
Envelope utility use to protect DOS applications:
- p5 `3 L, y* r
$ E1 t" i9 N  p9 X# {9 t5 U- I, T8 S
4C19:0095   MOV    AX,0911  ; execute command.
6 J% z! U8 g" r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: }. C- |2 D' J6 i
4C19:009A   MOV    SI,4647  ; 1st magic value.3 i' Y7 V( ~3 W5 a( n5 n
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 \# m+ \3 U) F- {4 h4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)9 C4 ?+ Z8 g1 W; b# g
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' r! m2 ~+ x4 X2 n  B. y
4C19:00A4   INC    CX6 E7 g+ ^4 \; P! v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- b" R# t9 z4 V" l' W4C19:00A8   JB     0095     ; 6 different commands.5 M! T" L7 w: ~  q: X3 ^9 H
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 v3 e# g  P6 o( o4 U/ v8 K9 F4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' }/ x" C) M5 y3 Q( w) Z
5 l# _1 ]7 D9 r" e' `! x+ `" g8 F
The program will execute 6 different SIce commands located at ds:dx, which
4 f: T8 C3 ]1 H  [" F& rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 y" Z& M$ V$ ^+ n9 Z8 j* `6 d6 g# Y: T7 g# M* L# i" s7 r
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 l( N& B* A% C1 [9 \0 ?6 }- P___________________________________________________________________________
( s2 r& ~4 J2 t9 h; e0 ?1 A1 g6 }& O) u# C6 F% r
4 V( D/ Q0 g, o5 C! g* A
Method 03- W- q: r9 k) N. e2 c8 V
=========
# J/ V: t* L) R& A0 |' J7 h
- d4 d7 f6 k  i) p' J/ uLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* D( ^- h; [8 s, W+ v- G(API Get entry point)
. Y5 Z3 z2 N. x8 D4 A        . E! D0 N( y- S9 W. Z8 y, e+ B
" j6 b& U6 p8 X1 r
    xor     di,di
# O( M4 S: s, C' V, i/ n    mov     es,di
$ A! V8 ~! S* R1 x9 Y* [    mov     ax, 1684h       # O$ S: P: j9 F2 T) P8 t
    mov     bx, 0202h       ; VxD ID of winice
4 }- v3 d( Q" q% @2 F1 c' J    int     2Fh1 I( [% n; _7 u7 e
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% D3 H, W$ O. Z; r    add     ax, di3 ^" [, ]% @( F( `
    test    ax,ax2 T+ \, _8 b/ k) S
    jnz     SoftICE_Detected
6 ]! v8 y2 N  _7 S' n$ N2 P( M1 H9 P4 R
___________________________________________________________________________
* o' R; E& b% d4 h3 q
( b: ~3 l8 {  b- T3 |) u1 R% `1 C; W8 U6 OMethod 04
% X0 J( u, q  L5 i4 x* K) w=========
- L) r6 }' _6 f* r; V5 {* ?6 G
, l8 L0 R6 G8 i% J* e( }, uMethod identical to the preceding one except that it seeks the ID of SoftICE" G4 |1 N% y. S( P2 I' e
GFX VxD.
: q. m' R: r. _; k! |2 E, r8 j" C+ w' C7 j8 m5 \0 Q+ F
    xor     di,di
) G  z: r8 k6 w) q/ ?  J    mov     es,di( H3 g6 C; ?4 }
    mov     ax, 1684h       ; J6 ^- Y0 a! x$ V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID) O5 E! b5 C0 q% @( {6 |- G8 c
    int     2fh" P; J3 n3 L+ w( L4 b  i) y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- p. W) [+ t  [    add     ax, di5 L, j" L" y5 G! P0 ]
    test    ax,ax
7 s4 [/ k2 y9 l* ?3 X3 B% P5 C    jnz     SoftICE_Detected
( [2 B, [# S6 S6 B4 s' k6 S' T+ }$ [' V8 P3 q6 d- X
__________________________________________________________________________8 Q4 L. f; {) u
! V, g8 K$ G. G/ ^
, [1 q  D& t, o" a8 O; B
Method 05
: p/ F; x. U7 L=========
6 K) y5 D# m1 V: T0 f- M, s! Y
: w3 g, N/ W6 q: I& Y8 }5 h0 Q2 RMethod seeking the 'magic number' 0F386h returned (in ax) by all system. w0 L; F& R2 J& k% u
debugger. It calls the int 41h, function 4Fh.
, J: h0 \0 C" ^0 ]6 h5 u% {- o0 {There are several alternatives.  / r4 G' q6 N4 O& T4 j1 h

/ s+ Y. J+ X+ ^5 K0 S$ z0 c  pThe following one is the simplest:: {: R! ^* j+ J( g! B. F- t

& ~+ A1 Q5 _; J4 g6 V0 X    mov     ax,4fh# j9 K. e5 Y. \' c, P
    int     41h
) Z; ]" ^2 q& R; [" u    cmp     ax, 0F3869 N2 N5 g. w7 y5 R7 J
    jz      SoftICE_detected
' k: D% ?4 _/ E! n' ?7 K6 A& s* B. @$ g8 e8 s' M# @; G- _: M- ]

0 P* _4 D& g  w# \1 q1 PNext method as well as the following one are 2 examples from Stone's
/ I$ z9 J; Y, s7 F0 K& e"stn-wid.zip" (www.cracking.net):% Y, a$ t+ ?8 \. z9 ~

9 ?' e% h- V! q4 d: \    mov     bx, cs
9 d9 d+ g, Q2 I* n    lea     dx, int41handler2
6 Y$ y4 X" |: v0 ~+ e& x    xchg    dx, es:[41h*4]
$ s* x3 L$ P0 {  r, }    xchg    bx, es:[41h*4+2]
' k3 T& x, h; P    mov     ax,4fh8 v7 l% M6 X0 e2 f
    int     41h: N. {* w- g" `/ y% [
    xchg    dx, es:[41h*4]! a' U" b" Q0 o3 R
    xchg    bx, es:[41h*4+2]' W& \" E" _" k& A- D
    cmp     ax, 0f386h. ~6 V- \# R4 r5 G' B5 R; q# v% |
    jz      SoftICE_detected, `2 R" Z, F) p$ f

2 ?1 A+ ^% k6 t5 L1 {. jint41handler2 PROC/ A) a# X/ Y, t/ i* n; J: a
    iret
/ s/ b4 G( [, n1 h% tint41handler2 ENDP! ?' a. @' c: ~

6 o7 J- |: y+ ~0 S- X+ o' n; D- G( `
_________________________________________________________________________% {( ?& }0 d1 N8 R) b1 b$ b* z: y4 c
3 f5 `# S( F$ a- e
* v  G) ]/ f- V3 q' @, n
Method 06. r7 e. `% ^0 j8 a) `
=========
0 ]3 X! w2 U2 n/ o' D- C8 k. ~$ _& ]7 Q4 x' x0 B$ e/ H
) f: I5 c6 R$ L/ @7 A
2nd method similar to the preceding one but more difficult to detect:( L4 `5 v. }; [; s
9 ^% S5 e( V5 C( d1 C- ?+ t- k5 t

+ @. v, M% T0 j: Z; uint41handler PROC
# x( {" K2 H1 l6 }6 ?. ?" O' E! e7 a    mov     cl,al2 P# D% [  U% K1 p# Z
    iret! a& p2 ?; A4 e$ {, n6 n9 X7 m
int41handler ENDP
! H8 p6 `9 {8 {9 A7 f7 K, ?! X& y- @/ n. Q- L  ?$ D! b$ h

  C+ r! Q9 f3 k9 C' C    xor     ax,ax
5 w, T1 Y* w9 t+ \    mov     es,ax5 B- Q7 C" f; J4 K6 }& s
    mov     bx, cs
, M4 j: u4 ?1 }5 B& |) Q$ g0 ~    lea     dx, int41handler. n; O8 u0 t5 j2 Y" f1 U2 @4 {
    xchg    dx, es:[41h*4]2 ^/ N3 F6 x" h& B
    xchg    bx, es:[41h*4+2]
; X# w; V) |! i; V    in      al, 40h& W  T' r& }) ~; N4 T
    xor     cx,cx
8 g! X' B6 T8 C& U, R) A9 f    int     41h' E* i# L. j  \  {1 K  {2 n
    xchg    dx, es:[41h*4]6 k( G4 z( |7 Y3 c
    xchg    bx, es:[41h*4+2]4 e3 x7 @* S' E7 I1 F
    cmp     cl,al
! l- R& _9 M* U! J- U    jnz     SoftICE_detected
% ^7 y$ g2 t% p: R, M
* j- f( k; C: g1 J$ ]' U5 U_________________________________________________________________________
/ D7 j2 b& Y  V" p. h- O+ U
6 J8 m' z/ a' y6 XMethod 07( L# U$ x4 O. d9 P: h; f0 r/ x
=========9 q, N  h) T$ a6 j' W- B

. y! A7 _. p+ ~1 F: f3 OMethod of detection of the WinICE handler in the int68h (V86)
7 w) g1 l1 o  w8 N- y/ T& f/ M4 J8 T# q' O% `! b' _
    mov     ah,43h
9 t. {; {  \4 u, E( U9 l. s8 w0 h    int     68h, M" h) r3 O4 D3 K
    cmp     ax,0F386h! N: i' a. l0 w) Q1 M, Y
    jz      SoftICE_Detected
, c2 M; r9 V) U- j  q4 J# \! z5 v
, }* D6 J# X, `3 m& j, h! h1 A  [5 B; z# G6 f
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# |  K, |  u+ t  C
   app like this:3 C( d' p! W4 I& I
9 I$ l; U% j! p8 W+ a
   BPX exec_int if ax==68
% ~9 i5 G# y. w( n   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 ^. s# \" J1 ]; C( u   located at [ebp+48h] for 32Bit apps)
+ m5 j) V1 S3 Q: k8 o+ v. O__________________________________________________________________________. x1 m7 c- d  Q. B7 F
2 K* o) U& ~# M6 p
! U6 b8 e1 t% t! k% z- a
Method 08- @4 n1 G* r/ \% h7 L! C
=========1 A6 T8 t% Z9 K: `4 y+ k) s
  P! r" Y/ R1 k
It is not a method of detection of SoftICE but a possibility to crash the
; s" U  g8 O$ k& [system by intercepting int 01h and int 03h and redirecting them to another7 b( S6 q+ }7 [+ K5 B
routine.
* K- c. v8 g. d! j3 sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ _! N' S  h/ P' h: ?  D
to the new routine to execute (hangs computer...)
/ O/ o0 M4 [1 {5 N) s1 d8 }* s1 k) E" M1 J6 b
    mov     ah, 25h9 M/ w6 e+ D2 M9 i( k
    mov     al, Int_Number (01h or 03h)9 N3 w% a4 i, ~) b' F" W9 m
    mov     dx, offset New_Int_Routine: T! u3 \- h- d3 ?) y& b
    int     21h
& S) N1 Q$ A8 V3 P. R  Z7 T- w* j1 Y+ B
__________________________________________________________________________
5 {) r+ r$ [. I3 I6 H- w
4 `' J. k  h, _8 H$ K4 \Method 09
( K% x  E( b' g, |2 k/ v6 Q4 m=========8 n  K6 d) i3 l: l& v3 Q- T& Q# K

5 Q' n2 l; z" I' I6 ]. J0 HThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 Y5 Y$ e( j0 [performed in ring0 (VxD or a ring3 app using the VxdCall).8 C4 J; E, l6 E
The Get_DDB service is used to determine whether or not a VxD is installed
* P1 Z9 o& L5 s$ u* H! Zfor the specified device and returns a Device Description Block (in ecx) for
: F" }" k- d# d5 G, qthat device if it is installed.1 R# s. O8 }* q
* F1 Z' R' y! h% R: {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: E. u5 d2 d8 K$ {! V# y  O8 l   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 O- Q& R7 O( c  j9 _5 G7 j! z
   VMMCall Get_DDB
" g$ J6 b. X2 S# c1 p+ r9 r8 q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 ~1 `! l2 F& f

, l" q/ b2 o( INote as well that you can easily detect this method with SoftICE:1 \( }; Q5 @& W8 v
   bpx Get_DDB if ax==0202 || ax==7a5fh
5 M5 q* n' |5 H: @, f5 Y& _" A# M1 g# |0 o7 s7 S1 r
__________________________________________________________________________; b/ w4 U1 L% e. q- R% c

) N  P. V! o) r% |Method 106 t; }: T; U* N: S/ I) l
=========8 _1 ^5 d0 B9 G6 c5 X

+ }0 r- W5 w% U1 @; m4 ~5 ~=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% a& ^( J7 l( d1 t0 _( e  SoftICE while the option is enable!!
  J/ P% V$ \" f8 f3 t+ D8 H) K+ r0 A4 L- X8 U& _  e2 F: X% N3 o
This trick is very efficient:/ g: z3 e0 n1 g2 U( s! ?( I) Z
by checking the Debug Registers, you can detect if SoftICE is loaded: p9 n0 c3 e/ }/ p1 O2 B
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 Y' s4 o' l/ R( k" x! j
there are some memory breakpoints set (dr0 to dr3) simply by reading their  Q3 P1 n" Y  f! }) Q& i
value (in ring0 only). Values can be manipulated and or changed as well+ u1 O) H3 F- @$ T% s# ~$ w0 f
(clearing BPMs for instance)6 t" l: J- ?# [
& ^# g. A( Q* x/ D7 k; l9 O5 _
__________________________________________________________________________( A4 u: _$ k+ [1 ?. N, k0 u2 ?9 i
' a% v7 Z8 O4 {3 z; y
Method 11
9 L- v' w4 x9 Z1 p1 g# I=========# ?% m8 o9 H( W- u5 R

( }  K; w) N: d+ m+ c3 eThis method is most known as 'MeltICE' because it has been freely distributed
. r& S+ m4 o3 Wvia www.winfiles.com. However it was first used by NuMega people to allow
9 a. F- l! d1 B( a/ BSymbol Loader to check if SoftICE was active or not (the code is located2 A' _/ r( d" P; o1 F$ U! C5 V
inside nmtrans.dll).& ~( P9 X& J' W0 v2 P
) [! [$ U* R: ^# e/ M3 }2 E
The way it works is very simple:
/ `- @) D' E/ l; nIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 R! }! Q+ G: v, X2 k" n, P( b
WinNT) with the CreateFileA API.
1 N# _6 a/ U: d# ?1 J7 @) u$ z) l+ F
Here is a sample (checking for 'SICE'):: W0 ?' ~/ N/ \8 _% |( C4 b) A0 W
3 ?5 V7 A/ o% E6 u3 [, A
BOOL IsSoftIce95Loaded()
' J9 i3 Q+ \4 Z  @, f% F{5 h# U% S& H6 h9 T+ o/ H0 T
   HANDLE hFile;  5 G+ {( q) C# d
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
) s/ w# v* N% h7 i' Z9 A5 P* x                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ l- g  _" s* T
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 g/ W+ g5 l0 d- O2 P& g+ [0 S: r; k
   if( hFile != INVALID_HANDLE_VALUE ), X$ G9 |6 M, @1 v  p+ I; [
   {
  m8 ^# X9 q- c      CloseHandle(hFile);
( \1 u2 S: O$ s2 O      return TRUE;& W. c- c0 s, U9 G( h2 v
   }
; ?+ p5 e. ?) w% I9 E! ^! p7 @   return FALSE;' H. N; D  \  Z# B; m: W
}
5 Y* B1 a2 W% I3 H; ^3 B( ]; `
Although this trick calls the CreateFileA function, don't even expect to be
6 x/ Z3 L  R8 D! L& G6 I0 W1 P& }able to intercept it by installing a IFS hook: it will not work, no way!
' |/ ]& K: @$ |5 T1 Q  E0 C" j% n( QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F6 t' d- u7 j) n. i& O( q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
" d; c( s5 {4 F  G  m6 Rand then browse the DDB list until it find the VxD and its DDB_Control_Proc9 C5 a+ M4 b# r' k0 }' B
field.3 W* e  g  p" `2 n* [& f
In fact, its purpose is not to load/unload VxDs but only to send a
- s3 x  Z5 i) q, }! U* |+ EW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. ?+ q6 z) W3 j! Zto the VxD Control_Dispatch proc (how the hell a shareware soft could try2 I$ s% p1 f% m. n; h$ M
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 q5 p* a2 e2 e0 w/ H3 ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow- G3 K7 u0 _; Y/ w8 T9 R
its handle to be opened and then, will be detected.0 |" \( `2 e; w: b5 M
You can check that simply by hooking Winice.exe control proc entry point& @! o) `/ l0 `5 B6 w, u' r
while running MeltICE.
# ~, @$ K2 n! y- F/ i; [, A$ T8 h, z; r! A" [! e- U

3 p6 |. s' u& j! U4 F! F" W  00401067:  push      00402025    ; \\.\SICE
" P" v; e% t% A$ ?. r  0040106C:  call      CreateFileA1 A. L' C- v% [9 O$ y5 d" _7 C
  00401071:  cmp       eax,-001) ]' z- O0 X8 M2 W5 C
  00401074:  je        00401091* E1 |! \) ?3 x& |) d  Q2 |) V
& @6 V: d1 l% x' d& T

# g8 ^# x' i% H) m% ^- |" ]  PThere could be hundreds of BPX you could use to detect this trick.- O! y4 O) j' \, Z2 _9 o) z) m6 Y8 [$ q
-The most classical one is:
5 l) g+ y% B0 }* J  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' e' P+ c5 n  a9 b& T5 X. h
    *(esp-&gt;4+4)=='NTIC'" ^' E- P# u  P0 f! M2 K

/ s% w/ q+ |3 j+ A5 y( g- P-The most exotic ones (could be very slooooow :-(  z& i- y: d$ S2 `' L& t
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 D% V+ @7 j' R  o     ;will break 3 times :-(0 a4 B9 r" v, h5 y
5 |2 i% h* _4 N$ ]" t# f
-or (a bit) faster:
: B# c: W( s# d! q' ]' D   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 T/ W1 D# c0 r
/ x# J) j% D% W1 B9 y   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 x; u' R7 J9 \" T8 ~+ d9 Z, T' i8 ^     ;will break 3 times :-($ H  u1 K+ `3 s; N( x* Y$ L" M  H6 Q
/ M0 C- f0 J; M( C- g% |9 K
-Much faster:
8 p( y& |6 z! N- A- B# q; J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 A5 I4 m# N- j1 B9 ^
: ]; W2 d1 ~/ l. T9 z( gNote also that some programs (like AZPR3.00) use de old 16-bit _lopen0 K6 N) t& g1 m
function to do the same job:
. t& m, {/ r% N, `$ @. }- _' G5 _& P- q4 Z$ r
   push    00                        ; OF_READ
/ i" _1 Q- ~+ K   mov     eax,[00656634]            ; '\\.\SICE',0
& W2 c, q* G/ ~8 n   push    eax8 X# O: g  z- K" }# N3 s3 S
   call    KERNEL32!_lopen
3 d1 {' Y9 Q6 x# ^3 v. K% P. n9 I   inc     eax
* d+ m& J% U/ k8 ]* C" C9 S   jnz     00650589                  ; detected5 j) `  f2 p, b6 `3 m
   push    00                        ; OF_READ
% T9 k  E$ e, V! S7 B, b   mov     eax,[00656638]            ; '\\.\SICE'. _5 f. d3 V4 R6 \( A4 f
   push    eax) j; b, X" N' j
   call    KERNEL32!_lopen, k$ f- \$ I1 R8 o. E- h. S+ j2 }( H' g
   inc     eax
3 e. _- {: y" S+ |5 [( X   jz      006505ae                  ; not detected7 g- F4 I; ^( W! o
" A: A2 {: |& ^

2 y, J& a* C: d  t1 |, O__________________________________________________________________________8 a* n2 _" f: s+ M$ C# {# ]7 N

0 s* }# `$ F1 U$ [Method 12, c; @! Z0 ^, W) ?
=========2 e7 P/ H4 z7 n! h+ \, r, c$ ~

& E4 m  B9 Y$ X6 k7 e! F6 _This trick is similar to int41h/4fh Debugger installation check (code 058 _: F6 ^& A6 W& x/ b  H
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% j) m) K* g& I& D/ }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.* O4 \+ A, k: s

4 b' ]# y0 s' t0 J   push  0000004fh         ; function 4fh
2 B/ V. r0 G$ t   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 }* `, o$ z8 L                           ; low word specifies which service: h  u( j. Y( D4 i4 G
                             (VWIN32_Int41Dispatch)
* @9 r, F7 H6 A. T# o! d+ f   call  Kernel32!ORD_001  ; VxdCall. r. A5 t/ j1 `- E/ v, u7 O# Z
   cmp   ax, 0f386h        ; magic number returned by system debuggers
  _! R; _) \7 G7 ?$ c. i& d. G   jz    SoftICE_detected! ~8 z9 ^2 A* d% w
0 w. ~0 A& ~0 {4 C% x1 K  ~
Here again, several ways to detect it:, L7 d5 K5 Q5 M3 M, h- p# r2 C; _9 @

) b9 T. i  A) Q  D& f) Q    BPINT 41 if ax==4f
5 ^2 H2 k3 \3 J' M& l+ [3 \
+ y1 t% v- E  ]; L* z+ V+ n  b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! I! m" {/ U4 L/ @2 P

. o6 s3 G+ z' p1 k. |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
, T5 q7 M5 z" k  i" ~
7 J& Z0 F, n: J1 J) S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. Q- |5 J/ X7 B4 W9 `
2 Z; b- T; B( r  \( V8 t% A__________________________________________________________________________
# _- W. D, K+ e, ^; w2 o, D7 w$ T  C4 U: ]! \
Method 139 c) T, _! D( z
=========
: O$ N" }( L( R9 R$ ?& |) }  @. r! L3 O+ `8 M, X/ n) t
Not a real method of detection, but a good way to know if SoftICE is+ s2 R: Y( o. c7 b. A
installed on a computer and to locate its installation directory.
. D2 [+ o+ i6 Q, N' M+ k# x7 sIt is used by few softs which access the following registry keys (usually #2) :
& ~! _" V8 Q3 H
) b! c, B6 u% s$ s! V-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# x9 g$ F% b, Q1 e- p\Uninstall\SoftICE
: c- a9 |0 E' Q6 X) x* }! V-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ w! _- l0 n+ ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 P5 j4 H5 b8 }* B! F+ }6 G\App Paths\Loader32.Exe
. V* q6 G- b5 Y/ A* G/ J
6 [4 f5 P) F7 f2 [6 [1 v+ [+ E) Z, K7 W9 s2 J
Note that some nasty apps could then erase all files from SoftICE directory7 y, {% ]9 k# V, L( \+ n7 h
(I faced that once :-(
4 ]0 Q! v7 G' f3 i% Z5 a% n9 l6 h3 }" h7 T5 p
Useful breakpoint to detect it:, j, ]8 ]" C; O+ A( T6 v

3 d+ [$ o0 Y* f1 E     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- r1 e+ W: b/ o$ i7 |

3 z2 N) ^7 G+ }' M$ T__________________________________________________________________________$ C2 e! f# o- x" S

, _  ^2 z) {; j
2 q: J+ O, W( U9 `( m: gMethod 14
( m& D/ t" l( t/ `=========
8 ?" V5 V+ W# v& c2 _
5 x$ z0 ]# k- c# ]A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose' G8 J/ y$ k+ B, j
is to determines whether a debugger is running on your system (ring0 only).- L0 N' W: l8 k2 l0 [

& i/ g( l) j7 e" P- ~, U2 E   VMMCall Test_Debug_Installed
$ w! J! N& i, p4 J   je      not_installed
: t+ E" B5 P5 D0 ]: Z2 b5 |% Z" P, ~5 T& B# `
This service just checks a flag.
$ e! f0 }+ K+ u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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