About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) z. j( \( b0 m5 I
<TBODY>( l0 B2 \; i8 T# r) l5 Y
<TR>0 w: O3 N$ e3 f, D- I
<TD><PRE>Method 01 8 M, {9 U1 N2 d
=========( I2 M4 d) F, O. U: E
8 e1 w( q9 h/ U- k% H" i* o5 `
This method of detection of SoftICE (as well as the following one) is  \. d/ z, c/ ?6 L5 o( y; L
used by the majority of packers/encryptors found on Internet.! [- r4 ]0 t0 f" r) }- e( o
It seeks the signature of BoundsChecker in SoftICE0 i6 f( Z0 a% ^' A

5 N7 O; f1 ~7 \, g2 V& A    mov     ebp, 04243484Bh        ; 'BCHK'
' `9 _4 U9 Y, L+ z0 ?0 e    mov     ax, 04h
5 O9 C) \( u( X1 x; A2 \$ t    int     3      
8 x  k) ?' w, v0 @  ^0 S, q$ l    cmp     al,4
" L4 l) n6 ]- A1 V    jnz     SoftICE_Detected7 K) V% @+ H# \

  _3 H- t" E. C' @4 Y3 x) @4 O___________________________________________________________________________
1 N. e6 g8 g# P$ f& h+ b
5 j1 k" V' u7 e% l1 }1 @7 XMethod 02
& U& I& d3 s5 C6 q=========& N! r) t8 m6 i* m

7 W0 C% S+ C: ^6 VStill a method very much used (perhaps the most frequent one).  It is used7 Z7 I$ d+ h/ H6 ]8 O: B& f' [+ z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
9 H9 {* C% v; d. [; j2 z3 C& k7 hor execute SoftICE commands...- {# [# s, u9 M1 l& y2 m
It is also used to crash SoftICE and to force it to execute any commands
# N6 D# |- Q  s(HBOOT...) :-((  
* L: C9 F) [3 {1 F- K( M% P& C3 s; f1 L9 L
Here is a quick description:$ y  y6 }& J2 M4 G3 p, l
-AX = 0910h   (Display string in SIce windows)2 w) U9 b( U7 ^9 `" g
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& N# ^' V  e! Y$ e9 r-AX = 0912h   (Get breakpoint infos)! k9 j1 G0 u* q5 f1 Q- A+ U' Y
-AX = 0913h   (Set Sice breakpoints)
% b8 t$ ?" X# a6 W8 @" }-AX = 0914h   (Remove SIce breakoints)
( o3 ^' g1 z1 x/ C: J! {$ G+ D" o+ {$ h
Each time you'll meet this trick, you'll see:
! I8 F& @1 t# g( ?# a3 S+ A, _-SI = 4647h1 Q- P" S# R0 g, C/ G/ t9 E" c
-DI = 4A4Dh; w0 w) `$ `# w/ D2 e0 C
Which are the 'magic values' used by SoftIce.
/ y: S' c& a0 jFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.& \+ E4 H  {% P  }- T1 O% I
& i) }1 x  T- A1 A! ]! A
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ \$ D8 X7 R! t- w
Envelope utility use to protect DOS applications:
. j( D9 k( y" y" U: d0 L
+ _2 E/ }- ]! ?5 z  W. y. j: q% W$ C' J9 z
4C19:0095   MOV    AX,0911  ; execute command.$ I0 O3 o2 ^8 f! |& l4 y/ {4 D4 b0 K
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 ]% Y7 B+ l0 A, d; }
4C19:009A   MOV    SI,4647  ; 1st magic value.: K/ N" c/ M- m" F' @; H4 L$ @. w
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
5 k% ^' C# _, F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
9 [/ S. s/ j! P1 J* W1 f2 s8 G4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute. A8 t% n6 N0 x( d0 O) u$ N
4C19:00A4   INC    CX
1 M6 _( @% m) N4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute$ H$ F6 [% \8 K$ x3 v- [
4C19:00A8   JB     0095     ; 6 different commands.
% _, o" `0 s4 |3 q' @, o$ r# `/ z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- k" {; m0 R# `4 K5 I) e; r7 x: {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 z* V) z6 h0 }5 o3 s

% t8 S& q1 j6 ^/ Q  S& W4 ~: w" BThe program will execute 6 different SIce commands located at ds:dx, which
$ S; }% d0 \: x" ^- T& d# Rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
. g" \3 {- w9 Z% H* B
, F4 G( `( i- u5 P3 `* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ h1 Z" u. E/ ~  }* T8 Y___________________________________________________________________________
* E$ _) ^4 v0 r$ \. u- d0 y4 Y. _: e9 t$ K+ e. ]0 J

2 C% i/ M5 D) E6 X& I; fMethod 03
9 W2 J2 V+ I' B- Z, p% b=========9 ]$ o4 Q( z& A1 `1 `

- ]7 b* [9 i7 F9 o8 ?" R9 O- }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  a! O  Y7 O4 ~( E1 {4 j! e
(API Get entry point): o* U' K# B4 x0 r/ Q# f
        ( z8 `  q  G7 D6 Y* b& W9 Z' [0 q

5 x% f) c  Y* P, C8 A    xor     di,di
" c2 d. Z/ L0 i' ]$ w- e: `# n    mov     es,di7 g5 _1 \. Z$ B# @3 R5 M
    mov     ax, 1684h      
' ^4 Z+ S1 t( Z2 _! V    mov     bx, 0202h       ; VxD ID of winice/ R! ^2 F2 U3 K2 a
    int     2Fh
! P7 r  O' Q+ r8 ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 z$ v/ P# g6 }    add     ax, di3 n+ w+ E5 I& L$ [6 r; h& X
    test    ax,ax
% X; a2 A, D- M# ]1 K0 D    jnz     SoftICE_Detected
# Q9 J/ ^  f6 Z7 i
8 g1 F* P5 N$ {6 g___________________________________________________________________________( ^( w1 `: L& M# ~4 _$ Z7 K
- b! s& @6 V4 d# c
Method 04, ?& a4 L2 T0 ~% H% s0 w, T" W2 T
=========
& V0 o$ C+ a% P! ]4 W% b: j( ~/ x' b
8 t' x5 ]1 h/ R. A; x+ M/ o* j# y8 ^Method identical to the preceding one except that it seeks the ID of SoftICE
% Z8 V- {* W7 {: e8 IGFX VxD.' p4 d- ~  z, H: ?% h+ a
; ]! c& i/ i( l$ v& L
    xor     di,di4 o- i7 x2 q) F) L7 j
    mov     es,di
3 ^8 b6 v' Q% `2 x& }    mov     ax, 1684h       0 y5 X  r; J( A2 T5 h, u5 |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% i, }' z& M8 j3 i    int     2fh
1 B% k  |3 D5 [5 F$ Q- P! r" k    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; B8 \; Q3 d2 h' |- ~: T    add     ax, di8 L5 E. o" r( J
    test    ax,ax
1 |  t6 _( w1 w" [- H( v    jnz     SoftICE_Detected/ @, H$ c& R7 U. _8 i0 H" E

" K2 T+ B3 L4 v9 \5 X. V0 E__________________________________________________________________________. M! l5 e. T- c3 m: k

/ f" r2 K$ h( N( N
* g6 b8 Z$ g4 C+ I$ D3 RMethod 05
( g3 d4 ?/ M) a=========
: O3 u+ M- F2 G1 D
+ p* Z9 F3 V1 j  D9 eMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 Z, p4 p- o  s) {
debugger. It calls the int 41h, function 4Fh.
- J2 {+ z/ c* u; Z8 q- AThere are several alternatives.  
: ?- }) f6 q0 Q! H3 W1 t' z" n, i8 W; d- ^7 \& _* r$ T+ B# ?
The following one is the simplest:4 `! f7 j: T$ u$ D
" F6 I8 Q6 Z! ^$ M
    mov     ax,4fh
( P2 i0 @& l6 y7 s    int     41h
$ ^/ {* P! X/ ?9 p# v# _    cmp     ax, 0F386( O3 k; H* n: J% G
    jz      SoftICE_detected( ^7 ]1 w9 H! E+ _* c' f

( {1 r7 H& X4 c# S& b2 K+ K2 G! _9 a) t! w
Next method as well as the following one are 2 examples from Stone's - a' q* c- N5 p  r/ |4 [
"stn-wid.zip" (www.cracking.net):3 i% q+ ]4 y, [; Q$ [0 w$ J  V

$ n& [6 V; n% ]6 _3 s% a8 x    mov     bx, cs
! X8 X3 {0 O! ^    lea     dx, int41handler2
7 P9 K& z& u1 s) a' _    xchg    dx, es:[41h*4]  J7 E6 |2 P9 c9 W
    xchg    bx, es:[41h*4+2]
  G- t' N( T3 N1 r    mov     ax,4fh
9 {+ b" T  T+ j+ f7 B    int     41h$ k' P" t. F! [' a4 j% F
    xchg    dx, es:[41h*4]/ T, x$ v8 a, p! ?9 z
    xchg    bx, es:[41h*4+2]
2 W# B$ V) x6 l% @$ m3 |    cmp     ax, 0f386h
8 @% k. _  l' Q# r+ q- s    jz      SoftICE_detected
) p8 S( H/ o+ S+ T: ]7 A; A3 s' [' h6 R: E7 \
int41handler2 PROC
2 N7 H9 P4 b% j! U( P& }. Q    iret
; r& A1 |. ^6 ^& p+ Mint41handler2 ENDP
$ [8 n+ Z+ {* {( f! {9 G$ I: u1 {3 J  O1 G3 ]8 O3 m/ R

& i) G' l/ N, J, e$ U" Z9 I_________________________________________________________________________/ i% [& J8 r: s. c: V( b2 R

, K* d1 G. R% F3 `" u* k, A- w, g$ p3 ?* a/ ~& L+ n9 }9 K: ^4 Y
Method 06' H( [4 b2 e) m. L  U
=========
7 l  v4 L! v* W8 |4 I# e+ m! W3 z. }5 f( G
/ L/ P* i& e0 ^9 P
2nd method similar to the preceding one but more difficult to detect:
# l' N+ T8 {7 K0 j2 b: m! J4 v1 N7 n
+ K2 {7 ?! g! o- L# n% P) Y3 j
int41handler PROC
- K& Q: P4 V8 E( p4 l$ ?% W    mov     cl,al' ^0 T$ x% b$ O
    iret( P+ t0 L# P7 r8 |5 s& X1 |
int41handler ENDP
2 L. i; F5 h+ z& ~6 [- c
- C& f, X; p, k4 T+ V' F7 Q: I6 x5 Q6 m) q5 O
    xor     ax,ax- t) ~: {0 I& H6 A' h) G, S' j0 w
    mov     es,ax" U5 p( m. r  _' ~0 B
    mov     bx, cs
  O" P, V8 }  p" s4 z* W7 C    lea     dx, int41handler
4 H+ ?' N7 R- X- x, X    xchg    dx, es:[41h*4]% U9 t; \* Y1 H4 l) X7 r2 J
    xchg    bx, es:[41h*4+2]/ }2 |9 i; L, ]2 L  [
    in      al, 40h
& B2 H( u8 h& P2 ]# ?- W8 ?+ I    xor     cx,cx
9 o/ i! `& Q) L! B1 d    int     41h; H9 B( @% \: w% m
    xchg    dx, es:[41h*4]
' q. n; z3 @8 o    xchg    bx, es:[41h*4+2]
- w' X4 o9 w. {) m4 K    cmp     cl,al
& A) G: n  z$ F    jnz     SoftICE_detected# z2 R3 q( w! d0 P
) i, s0 v# [: o7 U, ]( R
_________________________________________________________________________$ Y$ P% x# ]) h( ?) q
; f- X* m% {0 k3 E, H6 T8 I9 {5 [
Method 07: c6 D% i4 D' X) A7 c6 |
=========
7 w# l/ |; K) @+ b0 p& d$ C; q2 A0 W7 z7 u7 u0 u; g
Method of detection of the WinICE handler in the int68h (V86)3 m& {- a! g* v& s
: z/ l* N# r: O' [) Q
    mov     ah,43h
$ R, c, _6 |  C& i: c6 _    int     68h
+ O  }% A% B8 c9 x6 I    cmp     ax,0F386h
9 C' G, }9 r9 e    jz      SoftICE_Detected
* U* R# a$ I  t- D5 M; ~4 @* {; F+ [/ b% j- j9 E( [. }
4 i. s# ^- W; A) _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 s$ a' k. w% e   app like this:2 Z" F2 e+ S* x
; J3 N! C9 Q0 s
   BPX exec_int if ax==68
$ a3 v, r- j3 q   (function called is located at byte ptr [ebp+1Dh] and client eip is
: N* N/ F! O$ k, e( ], T   located at [ebp+48h] for 32Bit apps)2 L) J+ P3 K+ [7 W3 M+ ]9 g
__________________________________________________________________________- j, r& {3 ~6 q6 [* \
1 x0 W# {; w1 f/ [- Z" F$ z2 E

# e( F. F( [7 ~& k: UMethod 08
/ W  F3 S; Z: {0 P: l=========/ W) s$ Q- A: ?

/ q/ d# P/ v# l) }It is not a method of detection of SoftICE but a possibility to crash the6 s" t0 n; J0 C2 o; o) z
system by intercepting int 01h and int 03h and redirecting them to another
0 T# V6 I' q! A5 W1 \, c- e1 Wroutine.4 A7 N) M0 Z( e2 k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points1 d. u0 w. b# y- n: f
to the new routine to execute (hangs computer...)+ n1 X% J" o5 |7 q

! |& m1 L5 x' K/ g& j. _$ D    mov     ah, 25h
- W( [. E/ o, |, b" C2 Y    mov     al, Int_Number (01h or 03h)$ P, s! U7 `' X( ]
    mov     dx, offset New_Int_Routine: \6 i/ T2 f& u- h& r3 _* ^! N! X$ [
    int     21h& ]4 }8 O0 F- l

. M& o. o% m5 r6 U0 e4 ^# U  r2 Y; C* s__________________________________________________________________________; s. t1 J; c; X) _* S: C

3 K4 Q1 t. x3 Y2 WMethod 09# f& A5 B1 b7 {! N; @
=========
( l% W9 I( P: K
  _, w: a5 u& d6 J9 \9 oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 O7 E, r& q2 v# ]  I1 {. |performed in ring0 (VxD or a ring3 app using the VxdCall).
- y( o* q$ p- c5 N% f1 mThe Get_DDB service is used to determine whether or not a VxD is installed
$ ~' h4 V' B. Q: E, A1 Sfor the specified device and returns a Device Description Block (in ecx) for1 G  }% T& e! E+ v
that device if it is installed.. y/ d$ l0 z- u8 z7 g
+ D- [5 C5 Q" u  i2 j6 ]
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ j4 S0 ^. I( l2 Z# |2 Q8 |3 D   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 \' p. `- |* f& W. n
   VMMCall Get_DDB) E3 R; a3 M. u1 S$ o: s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. ^5 f: l+ N' D  ~" B9 r! _$ f% u
/ @4 ]# d$ R# n7 A% I
Note as well that you can easily detect this method with SoftICE:6 q" ~  l# z3 e- i' |; k
   bpx Get_DDB if ax==0202 || ax==7a5fh0 a! I1 i7 t6 K) p( ?
5 K; k+ @, |% R+ @. K+ J
__________________________________________________________________________$ ]7 b5 j9 _* z

& P& R# o( F2 cMethod 10# V4 J* E, E; C# u) l
=========
  m' `& g, M% W- P0 a. d" s4 T4 ]8 V6 e" |
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 R7 p# ?- K# m, }) H: s2 p! _  SoftICE while the option is enable!!
" s. a2 Y! H. x) T2 u0 {+ n6 p1 p! z- ~8 H+ M# b( x" }
This trick is very efficient:
# u4 g. P1 O' Z3 R4 Q! R8 pby checking the Debug Registers, you can detect if SoftICE is loaded
3 U" X, ~, G* o' j; O0 ^0 |4 F# j% m(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 M& _$ r7 ]% g, \% e5 Sthere are some memory breakpoints set (dr0 to dr3) simply by reading their
; e7 l. D2 `- N& H( {  M$ jvalue (in ring0 only). Values can be manipulated and or changed as well7 E! V/ Y: Z3 f- a
(clearing BPMs for instance)/ K! _; }8 x$ `& e( Z; I2 _! H
8 [% Y3 K' l! u+ P# x2 i
__________________________________________________________________________8 b3 m8 n1 }# O# ]& I

, L  {( N" E) A! b/ O2 tMethod 11
2 A: _& x* `# d  G! w=========" v- \9 a% A3 N/ b+ d$ {

! `: d# h2 w( V4 Y9 F& ?This method is most known as 'MeltICE' because it has been freely distributed' k! @# R/ C) P, V) m* Z& H
via www.winfiles.com. However it was first used by NuMega people to allow6 s- ]* R  y2 I1 B( G
Symbol Loader to check if SoftICE was active or not (the code is located2 \9 }. ?- j7 G& E" c. z+ E+ m
inside nmtrans.dll).
  ^$ h+ w" F# f
& h3 v( b$ h2 ^: V; j/ R+ ZThe way it works is very simple:8 J: a3 R; D" I' T
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ C* s. |  M8 y9 f  S3 W: kWinNT) with the CreateFileA API., o+ G  z  p4 o- U' X1 V
9 |  o7 t: }7 C. W2 \2 P6 a  U) g' L6 C
Here is a sample (checking for 'SICE'):
! O5 E+ f) n, u2 I( A3 {3 J6 A" I2 S
+ K1 L' t8 U! s' NBOOL IsSoftIce95Loaded()
/ ~+ f3 V2 Y6 _& _3 R{. i2 J, \* Q& G* q
   HANDLE hFile;  # w* d% U" h; r2 d. G6 U
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
6 }! _9 n1 ], _- ]- j. Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,1 m1 s! A4 m' c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 `, B2 ~) l' [) H   if( hFile != INVALID_HANDLE_VALUE )
8 d) I9 h- r" L3 U0 I   {
3 Y$ K$ a: O- `5 R" |      CloseHandle(hFile);, f; m/ t2 z4 ?  J# ^
      return TRUE;
3 l, J4 p1 K" y3 L/ k' T0 U   }4 y0 L3 K* I* L5 w3 e  g% q
   return FALSE;* L4 i+ V2 Y0 t9 X* `) A* B% V
}3 [4 c4 m* L8 o) a  K, z. h
. ]" g. H- e: A/ t( a3 [3 R
Although this trick calls the CreateFileA function, don't even expect to be
1 w1 \5 ?( Q1 h! pable to intercept it by installing a IFS hook: it will not work, no way!
0 R7 o& _. w& B1 ~/ zIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 \! D1 n8 [% Q2 tservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- }% B, a0 X9 c  Z1 i& r! U
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ L4 d: g- ?) t2 P( i
field.. U0 X, v% Z! M6 z" i
In fact, its purpose is not to load/unload VxDs but only to send a
6 l* I7 U5 [& s/ @3 yW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 T" n8 [1 @+ l, s, A/ s6 Uto the VxD Control_Dispatch proc (how the hell a shareware soft could try2 c6 a2 H6 \2 h8 U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 I% \( H6 q  H- }! ^
If the VxD is loaded, it will always clear eax and the Carry flag to allow: l; r; q$ Q0 Q  d- N1 g2 A5 Z
its handle to be opened and then, will be detected.5 v3 L9 Y% d4 ~3 S
You can check that simply by hooking Winice.exe control proc entry point- f# k/ j& m, F; i' y" N5 T
while running MeltICE.5 u4 o- k, U+ \5 n, f4 H. s+ m5 M

# D/ d; V0 I# ]. h
( p& A2 B6 x, [1 ^2 s  00401067:  push      00402025    ; \\.\SICE7 G: k: a" [  c; O: @3 _' a! c' ]
  0040106C:  call      CreateFileA# ^* ?5 q  {- |7 Z  G7 {- t  w" G
  00401071:  cmp       eax,-0012 P' K2 k5 ~! c
  00401074:  je        00401091
5 F! ^- Q9 {+ i. w* X
: K% c2 Q6 Z$ l# J9 J) l
' s, t4 N! T8 t6 [There could be hundreds of BPX you could use to detect this trick.$ D3 x5 m, S6 t0 Z) w
-The most classical one is:0 d2 V( K  |" K. u, J
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 s: S+ }$ {7 |6 u
    *(esp-&gt;4+4)=='NTIC'& `7 j  _/ d9 x

, @2 K2 I7 k+ L5 V/ f7 M-The most exotic ones (could be very slooooow :-(
8 c: Q% b! h# ?, [( @   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & m! t# A+ g- E0 T9 \. r; u# T
     ;will break 3 times :-(5 ]7 R5 s+ L! Z4 i% J

% x2 S# Z2 `; A-or (a bit) faster:
  o" l& `3 X, M+ ~6 M8 J. O   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& G$ ]& F3 C# o* K0 C3 b
2 D( l5 A. X2 W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 D) h0 }  @; z( c% t     ;will break 3 times :-(
& `1 z3 h- Y; x+ h* m7 F2 u" X& n
-Much faster:# g" _- M, w/ B% A% Q# \- N$ b: p! o
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'5 H9 i0 p6 y4 W, X7 y8 y5 j: P1 h

8 r/ {0 j* R, c0 G" wNote also that some programs (like AZPR3.00) use de old 16-bit _lopen* ^* Q4 |$ |1 c2 H% P6 {  Q' K
function to do the same job:
! f  c1 A0 A1 w$ a/ l: m
6 e! ?$ p+ t* ?0 [   push    00                        ; OF_READ
0 P1 j1 P; n  o. R   mov     eax,[00656634]            ; '\\.\SICE',0
+ u+ u1 i/ ^! m$ |0 y   push    eax' f( c2 a8 X  m# p. N& ^
   call    KERNEL32!_lopen
: f* I5 ?/ b- q) \6 l5 L   inc     eax
% e6 l, q$ W/ m4 Z/ m% H3 Q( D, X3 E   jnz     00650589                  ; detected+ x2 q9 T. a+ B0 W
   push    00                        ; OF_READ
$ E2 |- N. s+ d0 A- @& k! k+ I   mov     eax,[00656638]            ; '\\.\SICE'- [: Y* A# C( [3 ]* {$ l
   push    eax
2 f7 M' i3 y& T' U   call    KERNEL32!_lopen5 [# w# V) }- r! I8 A) \
   inc     eax. k' ]5 z0 A9 [$ G! @5 H/ X
   jz      006505ae                  ; not detected' C" a; H. W2 f: h# x# b

8 f/ Y/ O& j# \
7 C# J' N9 ^  N1 D( F' c__________________________________________________________________________/ z3 _7 a) R& j2 B6 {+ g
/ P% M5 [# N" N
Method 12
2 i# k4 D% N$ I2 t; W=========" d' ^! U) Z) P! @/ \0 c, K
( U+ i. s# L" H4 X" m
This trick is similar to int41h/4fh Debugger installation check (code 05
, q* [+ ?- p- m) X% F$ ?) v! F&amp; 06) but very limited because it's only available for Win95/98 (not NT)# p7 A4 e, Q, _) u. m+ S
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; U. P1 X8 w- z3 O
' ]) {# W0 ~: {7 r7 e+ T, Y   push  0000004fh         ; function 4fh  I. _2 W. L' X' {* M& y
   push  002a002ah         ; high word specifies which VxD (VWIN32)( D( O; ^2 h2 }' ^- S3 `
                           ; low word specifies which service8 `6 f/ b5 Q7 f6 o4 B: v4 A
                             (VWIN32_Int41Dispatch), W1 j0 E0 q2 D2 l3 H( l
   call  Kernel32!ORD_001  ; VxdCall
& v1 d! E; O4 D1 E   cmp   ax, 0f386h        ; magic number returned by system debuggers
* ^6 {7 ?4 C' v6 j; |5 [& j   jz    SoftICE_detected
6 d" ]: W# ~! l! ?! ^( ^; a; @1 M( M4 J2 E. ~
Here again, several ways to detect it:
: q1 I1 G/ r+ P' k& ^" t7 ?2 I) a( R0 r' P- @  n/ l, R. }/ v& M
    BPINT 41 if ax==4f* b$ S; p9 o+ |. k) j$ Z& j0 f

) b* O2 P  T. r    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
7 T6 w3 \( Z/ Y( W" |( X& a
2 k4 S+ U' ]! U& F# X    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' \9 B# E4 i" g8 X# r. b4 }4 W! W% x- P; x$ ]5 _2 ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: M" ?: S: o" h/ c0 R; u
, g: w) r/ q) O7 b__________________________________________________________________________
5 p+ ^9 g" s5 C, a2 y: B
+ h. p+ J' \. U- yMethod 13
7 O! }/ y' h4 Z9 F1 o: @) S=========
6 G* N9 K0 A7 a1 H3 h- j2 q  A
2 e5 r; d  D. hNot a real method of detection, but a good way to know if SoftICE is
- i' M0 l) `8 E# X' `2 N* \9 H, Jinstalled on a computer and to locate its installation directory.9 N6 g( C0 ~& z/ s6 u: O
It is used by few softs which access the following registry keys (usually #2) :! `. a* V' Q, H( M4 v

" R) G9 ]% f! e1 O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* S" r0 H5 q3 @$ K; N: H5 G
\Uninstall\SoftICE
. \. j5 i  C% `7 S9 p-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 c$ F. \7 b/ U- p! |% Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 J% W8 W/ |: G* e
\App Paths\Loader32.Exe4 Z8 [. Z/ C' j8 ?+ L1 E

9 M. S+ k' E7 E% C% e/ S! z
3 @( r% w9 }* m) cNote that some nasty apps could then erase all files from SoftICE directory
! d8 R3 L  q7 R4 `* k* ~; F(I faced that once :-(
* o  B5 O$ a' \" N8 E' j; s. E/ t7 t
Useful breakpoint to detect it:
2 Z7 e. o, h- v% d5 n2 i6 x+ s2 H$ u. d1 @% J1 d; _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; ~: X" t/ J. Q/ h8 h0 W
7 ^6 t6 a1 M& N9 b" F5 @__________________________________________________________________________
/ e+ D. z  I5 x& C  [* T) {! C3 `- s) x. w1 q! s5 K7 S5 B- I
  W- \5 D4 d4 K7 k# O
Method 14 9 z. Q% E. o; d1 i4 b  }
=========, Y0 b! ?/ `5 U
4 j6 b5 t9 u) l; O6 g
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( f9 O4 g) c) q3 N- h" \3 Fis to determines whether a debugger is running on your system (ring0 only).4 y) `& l2 y' j  a* S
- e9 k% |9 z& U/ e, n* W/ |* w
   VMMCall Test_Debug_Installed/ C' i, d' u! q2 q- L9 P
   je      not_installed9 Q2 e/ v+ s! Z" q3 g' V) e
3 ~9 }9 s& u( X
This service just checks a flag., r, L5 D$ Y/ v5 h' M
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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