About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 ]+ U4 r2 R/ A  n
<TBODY>
( y: g1 x/ V6 `- w<TR># U6 N+ B5 q, W3 Y. x7 }$ W2 f
<TD><PRE>Method 01 % s2 q3 K+ |% N
=========  p0 C) b- N0 p1 U$ Y' Z
8 ~0 y: X* ~1 P- z3 f  g' J( r
This method of detection of SoftICE (as well as the following one) is
3 V. p! {9 A$ gused by the majority of packers/encryptors found on Internet.
0 l6 b! W# \1 r7 T  B- BIt seeks the signature of BoundsChecker in SoftICE+ u, e, G9 d  Y3 l  `% B
4 k  }0 |6 S" P- w/ q0 F
    mov     ebp, 04243484Bh        ; 'BCHK'
/ I% \$ t0 j0 n1 z3 z) [6 g    mov     ax, 04h
& R9 P& `" K/ o: k# T    int     3      
" h, u2 t2 C2 ^9 u! _    cmp     al,44 ?  B8 I4 U- _$ ?7 d
    jnz     SoftICE_Detected
" Y& P9 w& p; S9 @" u8 c- B. Z' L; i- g# V- p
___________________________________________________________________________7 P. ?5 m( N' x3 j; y/ `2 G

8 O' K$ Z9 E/ y. K# T" E2 P$ ~Method 028 ]' I) `1 J2 u7 o  q' I
=========! S5 d; g, c( Z
8 R; f  p4 @/ l/ Q/ B
Still a method very much used (perhaps the most frequent one).  It is used+ ]! g( A7 W! }! G
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! @$ G) H8 E" R; I; k' `or execute SoftICE commands...
2 m, P, ~# \0 P6 G& |# YIt is also used to crash SoftICE and to force it to execute any commands
! ^& z2 w, O7 n( |  j(HBOOT...) :-((  
' V+ g8 x6 y8 M' n! h" v
! n8 B% V6 o8 ?6 Q- I  yHere is a quick description:
+ m( Q+ \( m9 d% y) T-AX = 0910h   (Display string in SIce windows)9 Q; }  R3 w! d% z# N; o
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 Y5 W* z7 q# A-AX = 0912h   (Get breakpoint infos)
/ M, R. O% Y' J5 |- ^/ j. A; E-AX = 0913h   (Set Sice breakpoints)0 ]( Z2 B9 O' C5 e
-AX = 0914h   (Remove SIce breakoints)
; g6 _2 F. ?* k' N4 z: L* j3 P9 S
6 `% z# T. Y+ {4 C3 j# AEach time you'll meet this trick, you'll see:% {& B0 Q& o2 E
-SI = 4647h/ f3 x9 Z. @2 y
-DI = 4A4Dh
: h" e  ^& E8 D/ h  y+ IWhich are the 'magic values' used by SoftIce.
6 B2 R, ^' X4 Q9 o, s8 f' Z( ~For more informations, see "Ralf Brown Interrupt list" chapter int 03h./ s$ h6 s( e- z$ Q. t0 s# ?6 U# p; C: b, B
! Q( q- _2 B6 O; j- {
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 {4 F6 D: t1 j4 UEnvelope utility use to protect DOS applications:( t' Y0 @1 [8 B0 v* b# O
& [+ q( r6 `+ a9 x+ n

9 N: S8 O- N# O6 q+ q. ^' T  I4C19:0095   MOV    AX,0911  ; execute command.% j. W3 ]; N. y$ }( n- z
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).2 k( k: q" |1 p' y( \( Q& H2 m
4C19:009A   MOV    SI,4647  ; 1st magic value.% K; H. |4 \7 `4 P3 w5 N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" C1 \4 ^  i9 Q9 i% I4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 S6 n% g$ c7 r1 C- t$ e
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, C3 z  T' {/ P2 V; z+ B; W1 |- `! `4C19:00A4   INC    CX
% z$ k( x5 a- L5 I4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* b/ M! V- |2 E+ l- F4C19:00A8   JB     0095     ; 6 different commands.! r( n- x! }# g8 Q* A4 [
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 x2 _4 L  N! o4 z' ~, |5 `# Q6 N4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 e, M: z/ \; N* q. U' M6 |4 f

# F% t) v( z' U) `3 N# MThe program will execute 6 different SIce commands located at ds:dx, which' C; t4 v- c8 Z
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& f* Q) M% j# |) A3 l8 u7 c8 b- {+ _( E/ @" ?5 M' b: L
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
- _. r2 ?+ K8 I) d' k: T; y, H) E___________________________________________________________________________
1 C; _& [0 o, I* Q& i3 b) j- `: }  Q6 [1 R( J0 e- S3 t

. y# s( q! K( ^5 a; Q+ |Method 03. R* p9 k+ Q, u, q6 ]+ ?
=========
# t8 i9 f9 ~: l; l3 Q# V) _& c6 ~# I& K, W$ t6 b
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 ]9 A; B( Y( B
(API Get entry point)& f% v% O# \7 t6 G
        
* D! d7 `! {0 @( m3 M
% [) j* h; N3 v" k+ I    xor     di,di
7 s  w7 r- M+ ]# B+ o    mov     es,di
2 @* ?7 X0 r5 k# N  V) ?    mov     ax, 1684h      
; l% d0 ]; [6 b  a$ {( [    mov     bx, 0202h       ; VxD ID of winice7 D6 c( e) r( [$ a! n& t. I- |. d
    int     2Fh6 D' T. s' N/ J1 v8 h/ Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, s( Z0 g/ v" o1 ?    add     ax, di
- j3 N9 b& o4 I2 f% H6 e    test    ax,ax1 Z& @$ i& ~7 V8 u
    jnz     SoftICE_Detected
' ^4 d- d9 E& M/ @% a/ ]8 m$ B5 }) m' I. v$ i
___________________________________________________________________________
" _. D# E$ C4 {) x$ m7 t3 ~, W6 L, V) ?, w5 N
Method 04
9 k, L; N' A7 z& ?6 t& I=========; C" ^5 Y" f  X( x

  f7 N0 X. D) t* s! C! U- A" SMethod identical to the preceding one except that it seeks the ID of SoftICE' X4 U, G# j( [$ \' c5 i  u; N
GFX VxD.
% h4 C- [: G/ |! g. o& O: I$ Z! Q; q8 n/ r) z+ k9 l- {# G+ ?
    xor     di,di+ u5 Y6 ~9 o; L0 C# O: L4 Z; p( W
    mov     es,di
3 i* K: s0 w( T7 u3 x7 N    mov     ax, 1684h      
$ R6 T2 m7 ]* Y# \    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. M  k; v  ~- B8 x    int     2fh8 p3 @/ B& D8 k5 Z) r" \  H5 a) \* P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# u. C( A1 x! D6 ~# y
    add     ax, di6 `( u% T5 k/ B; Y& D5 m! A  w+ [
    test    ax,ax
. s4 E" r3 f* H/ Q9 v    jnz     SoftICE_Detected9 R. y& f/ u' M% F* t& s
( K" ~! Q: Z9 V( Z' a0 C
__________________________________________________________________________
0 E! c- x0 t& j: E' I& M, J' a2 \$ z0 {* X0 l9 Q$ _

( O- A6 ]  R2 d, w. u' {/ ?% }Method 05
! N  I" W1 `0 c( l=========
- Z: S1 i: Y: N0 @9 P: i0 k
, n- z/ h+ N4 \5 X& J( o& ~. nMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 R7 S, P' w7 z, ?, s. p+ y& Sdebugger. It calls the int 41h, function 4Fh.
5 ^3 c( I# W! \; l1 MThere are several alternatives.  2 A+ k9 j1 |9 @# ?. ^

* m$ `+ x% r: ^2 O- [6 qThe following one is the simplest:1 d6 }. J% h" \, \- u1 p8 h0 `

% W6 R% k/ b) s    mov     ax,4fh
7 h# y* \4 p5 N. C- u    int     41h
$ b# F% \9 K; `! y: q. M    cmp     ax, 0F386. s9 d, r5 m6 q. P8 o' F
    jz      SoftICE_detected. ]0 h, {% z; i) c3 j- B4 M3 d
, A1 G3 e( {) Q5 ^

! h: m$ R; r+ |- z" x7 f; J! ~1 jNext method as well as the following one are 2 examples from Stone's
$ Y1 v  U6 U/ @, W' z"stn-wid.zip" (www.cracking.net):$ w/ z* E, M# P7 K! Y( O& z3 j
2 D8 I9 A9 G4 ~( H+ a, t
    mov     bx, cs
( v/ M4 m- }0 c3 E: I4 B    lea     dx, int41handler2
$ N0 I, t  o& Z    xchg    dx, es:[41h*4]8 F3 I$ R5 ^* J& [* S
    xchg    bx, es:[41h*4+2]
2 W" o3 U5 k& K% F* `+ k5 S9 W/ ^5 e    mov     ax,4fh
8 h# g( j% o3 f! B. F8 K    int     41h
* Z: q; Q, A3 b2 E2 K  h5 M3 L    xchg    dx, es:[41h*4]
/ l" C# P  Y  D8 n/ \+ V6 Z- a! ^! x    xchg    bx, es:[41h*4+2]
! A3 t' B9 i7 n- Q    cmp     ax, 0f386h5 j3 L. K9 j3 r/ Q
    jz      SoftICE_detected4 L" Y+ s  ~- ~+ T" B4 P- q
# n1 y$ z0 e' d# e* a
int41handler2 PROC9 i. U9 j5 c! d/ i2 Z
    iret
" [. U4 F1 S5 V* j% n3 h+ i/ Zint41handler2 ENDP- y* P( J: T; r. Z8 W. D
2 Z$ x- d, E9 q" \! }; z

! I1 y6 i: v. ~" C' B$ t_________________________________________________________________________
9 H/ F# Y4 ?* i. _: Q) H! D
! D. W& w9 l* l5 z7 F/ c$ j+ y" [
Method 064 D, x4 V/ V+ A
=========
& i2 \6 ]5 S! a# Y3 D2 A% m1 K' n( a: X* w2 E: L, h0 z+ r1 }

; w6 Y2 G7 f  ]: n' w! a# [: J7 |2nd method similar to the preceding one but more difficult to detect:
7 ~  ~, c5 l3 X1 i( i2 Z% A: G6 N" q6 F! ~" x: p0 t6 I

  c, o, @& C' r7 V7 L% Uint41handler PROC+ D' r7 Z. k4 F# R7 ~' {6 }
    mov     cl,al( y$ p& }9 z8 A* [
    iret6 V% y+ ?) X( k- H
int41handler ENDP
' I% }" n2 l; f! d: |+ ^+ x* }8 h% o
: P: L9 k9 T( n5 d: O# y5 K
$ b8 n  k- I. e8 G    xor     ax,ax
7 @; l& Z! s3 E8 Y    mov     es,ax
7 b# I" N4 x6 K    mov     bx, cs
% ~8 b' o8 d+ e5 v1 `- A    lea     dx, int41handler% I) ^4 O" R$ n3 [
    xchg    dx, es:[41h*4]
5 z3 Y: d8 h' C    xchg    bx, es:[41h*4+2], L% V2 r. n+ `% N
    in      al, 40h
2 ~# z- w$ W9 k    xor     cx,cx5 _4 }) d- ?4 o! k" X* P
    int     41h  q! v+ }( X, ~+ i
    xchg    dx, es:[41h*4]
! S* s" H7 q0 u0 S3 T8 b$ p5 j2 @    xchg    bx, es:[41h*4+2]5 i) [, J- F- C2 q0 |3 Z% n
    cmp     cl,al
, m( p3 _% o, H    jnz     SoftICE_detected8 E& T* k0 {$ m. i/ q0 R
9 Q6 }1 b: J/ `; s$ `- C
_________________________________________________________________________, I, J; v( \; A

9 Y5 l% B  p, I- r0 NMethod 07. @: w8 L! K' H7 J5 p0 n
=========" ^# r7 M- |& F$ Z3 @
) O& }5 S$ f& [% L! @
Method of detection of the WinICE handler in the int68h (V86)5 R9 |: f+ ^; {6 T. ~# G
1 J2 t% z" @( d5 t( Q6 ^6 l  Q( F+ O
    mov     ah,43h4 O% f* Z7 C5 L/ z! P+ y' P
    int     68h
1 T: Y! }8 E1 y; c/ k    cmp     ax,0F386h
  d' }9 R* c! ?8 L    jz      SoftICE_Detected$ v- c, c) T' X* }

. B7 r1 M" _! @; v* f% J5 K" n. v8 Y9 [0 c' J2 S
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit* L" n4 b: u# k5 K" V
   app like this:
+ t: @+ V! H0 C, Q( t' e! D" t% U$ n& W9 U( ^. H# _6 y
   BPX exec_int if ax==682 V7 ?0 ]  h: k) k" K. `/ y
   (function called is located at byte ptr [ebp+1Dh] and client eip is# i. C' O+ f3 i1 `. j
   located at [ebp+48h] for 32Bit apps)- m/ }( q: f. \0 w; ]$ v
__________________________________________________________________________
* C7 ^: G0 Y) s$ R& u0 S& H9 r& j2 A. _! K7 w
0 F% H4 Q2 O* M+ q& S8 `
Method 08. H" L) r1 z) Y' q" d+ x
=========/ J4 Y* ?4 H8 o" g3 o, n. R  k
6 C0 W; c  D! |! @. O/ J7 \
It is not a method of detection of SoftICE but a possibility to crash the' R: C& U# J% f' X4 E
system by intercepting int 01h and int 03h and redirecting them to another
8 w- p6 W/ F7 @& C( {: E% @routine.
! ~' `8 e2 h9 F: k& ZIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ [2 Z' U( Q' u, Yto the new routine to execute (hangs computer...)
3 Q5 x& P& A1 n" h; Q' \. R1 K! _8 m) X1 q
    mov     ah, 25h6 \+ N% W) D: C3 w- D1 t5 g8 ?
    mov     al, Int_Number (01h or 03h)- q8 ^+ W: v& b% ~/ U8 {* r: ?
    mov     dx, offset New_Int_Routine
: s" D, a: H) a; V' X    int     21h1 W3 V- B( r7 h/ Z4 [' Y3 O/ w
! X; G. @9 V0 {* Z+ m
__________________________________________________________________________% A* }+ P5 W$ c/ y

+ ^- U% [" N% l: I( MMethod 092 e- S3 Q- W5 U) |! ]1 B
=========# ^8 J8 k' s* D0 e4 }1 N
( j' M1 {8 r0 ?+ B2 u
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 }9 n  e7 P( |performed in ring0 (VxD or a ring3 app using the VxdCall).5 ^4 m9 B; Q1 D- d! y* c. g. I6 u
The Get_DDB service is used to determine whether or not a VxD is installed
  a1 j: l% }" x( w, O1 p2 Tfor the specified device and returns a Device Description Block (in ecx) for- ?. N% F! L' M5 y6 D, [0 Y
that device if it is installed.9 I, _# X) o# X, N& b3 S
$ D+ c+ o. I" ?7 B0 U$ l1 d& r7 Q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( i6 v% o. t" f7 ~5 T   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 H% D) t' `, P2 }   VMMCall Get_DDB
( o% t/ ^; K- A' V) z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed; w  \+ k: P' r# N9 h5 F+ h$ J
  |+ ~" Z( ^, g: m7 A, A
Note as well that you can easily detect this method with SoftICE:
6 d& [: e# ]6 o8 s% T   bpx Get_DDB if ax==0202 || ax==7a5fh5 e( _2 r0 s! [2 o7 r& S$ j
0 r7 w- D# r6 A, ?
__________________________________________________________________________7 |" M. }9 A( Z
! r% C5 z' \5 C' J5 G
Method 104 I  F7 R' L* B2 T
=========: K' {4 e$ V. m3 J; P7 O2 H: r9 Q

; \9 i( t5 O2 w0 D. w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) |9 t  W. m/ m7 ~  v  w
  SoftICE while the option is enable!!1 ~+ m$ }: X8 z% K

* f  j1 i) x! FThis trick is very efficient:
: ]) q* I& B, K$ |9 E# n" `by checking the Debug Registers, you can detect if SoftICE is loaded
% c) R$ g: R0 g) w" t6 c- ](dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* \2 Q# P# S, K1 f  j
there are some memory breakpoints set (dr0 to dr3) simply by reading their5 a: j/ A( |6 ^
value (in ring0 only). Values can be manipulated and or changed as well
# k3 j: N, x0 V  F(clearing BPMs for instance)
" k; k9 T' Y7 p6 d' N' h
! A) a7 y' Z# o$ X! B__________________________________________________________________________' u; N( d, g. Z! C  @/ Y7 p
9 ]  h3 a# i2 m3 R
Method 11
7 w  q$ p1 T- ^7 e; y=========# ]# l+ Q! c- Z7 k1 \2 g& [* k

; z. _9 L1 c2 i) dThis method is most known as 'MeltICE' because it has been freely distributed: Q' z- Z" J- S# o" r
via www.winfiles.com. However it was first used by NuMega people to allow
7 o; Y* M; W! RSymbol Loader to check if SoftICE was active or not (the code is located
! P/ N/ F- |1 ~  Cinside nmtrans.dll).4 T* ?& B0 _- z% f, `9 L

0 N5 S9 {% k* V/ rThe way it works is very simple:
9 D8 I( l9 q- v# j- \' l4 MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ L- q7 `# Z* ^3 m" P8 o# u7 qWinNT) with the CreateFileA API.
* h! i" @5 g8 F4 a9 I5 r# c) }
/ f2 X7 e! R- G9 J  iHere is a sample (checking for 'SICE'):( v/ @8 |3 r* y1 ?5 f" C% Z

) k( N& F" S3 W' mBOOL IsSoftIce95Loaded()" p2 `' s0 g7 [9 {# e0 Q6 X
{
, n  ?/ y6 n. i; U2 ]1 Z   HANDLE hFile;  
2 i9 m8 p7 m) [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 G3 H1 k! Q* D, O/ x( T2 `                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 z8 {& S0 |0 I- A/ q5 ?" m9 e) y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" W" J, B2 F, c/ _( ?0 P- {1 P   if( hFile != INVALID_HANDLE_VALUE )
% N+ |$ `  Q* |. [5 P   {3 y) O* ?6 r5 J6 x" `8 [
      CloseHandle(hFile);
& W. i6 p" n' L; u2 _% [      return TRUE;! [, @- Z+ \7 v9 C7 i
   }
% B, j" ~4 I; g. z% a   return FALSE;
) i( _0 K2 T( c}7 J  n& d9 z+ P- }$ A, o1 }

8 C$ H( L) K% {0 d! _, K' IAlthough this trick calls the CreateFileA function, don't even expect to be: j9 b" [' V& n
able to intercept it by installing a IFS hook: it will not work, no way!. y: t" P/ m+ Z' q& r
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" {' J! {6 {: Lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 r6 A( |6 X% d. p1 _9 k
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# ]" ?( ~5 o! B9 w$ Sfield.
+ R0 z* e3 M* O  o/ f3 a& KIn fact, its purpose is not to load/unload VxDs but only to send a 9 F  o$ D% M( `8 \, c5 x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
- k/ y' t2 {: k$ s; C# vto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ @5 n! I' w0 _/ x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 _: z) X" {8 U/ n
If the VxD is loaded, it will always clear eax and the Carry flag to allow
  i% F9 q/ R3 `9 T3 ]its handle to be opened and then, will be detected.
9 U3 u3 ]! N; K& {/ RYou can check that simply by hooking Winice.exe control proc entry point
/ r9 t: ~6 K0 O% X# c& Fwhile running MeltICE.
# [  v  \/ b& T1 b( g2 P% J; y
+ @/ @. s- R: e! H) {7 g" G* t2 k9 i* m+ v1 z; N
  00401067:  push      00402025    ; \\.\SICE0 v2 y% P5 l0 v( }( l* e3 \
  0040106C:  call      CreateFileA
- q6 {7 ]3 }4 y$ Z* b9 _- j/ `  00401071:  cmp       eax,-001
2 t6 }& A/ u5 b6 W5 r  00401074:  je        00401091- k9 d2 i$ I9 M  t# o, L

3 \1 v% r% _. u) P# b+ y- q
) N# _7 n8 Z6 m; ?! QThere could be hundreds of BPX you could use to detect this trick.) {* H  ^* y$ E! L; D: l
-The most classical one is:
- F, m1 {& H9 w! L& t  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  n* _0 l# {; D4 ?
    *(esp-&gt;4+4)=='NTIC'
+ i0 c2 m4 V4 j: z* ^0 ~1 Q# b$ d1 p# @+ G% V
-The most exotic ones (could be very slooooow :-(( d: u: N/ _9 F; W0 B
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  7 y) G3 I7 w( ], J( N/ d5 N
     ;will break 3 times :-(
$ M9 Z3 w% A) K  Y
2 A8 {4 d; ]- f6 I-or (a bit) faster: ' h1 ]" N/ Q5 b+ R$ O
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' ]) W8 S- O: _  ^/ x

# \; h: _! U' `; Q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 v. P; X/ n$ M& s/ ^" r
     ;will break 3 times :-(
; T4 _7 m' a& b3 x% U0 H' m  o" `6 f. K* b
-Much faster:
" _0 W0 B8 F. _  U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; V( B  v5 ^9 j8 C# d0 v6 U2 {, q( R2 W3 \5 N
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
5 ~! M/ V) h% G: t6 |. M: hfunction to do the same job:: _$ o. ~! b2 r! O2 m

1 T& X* z$ E4 F8 u, b   push    00                        ; OF_READ
# C/ h, N, |* j6 H4 l9 {9 k* N) J   mov     eax,[00656634]            ; '\\.\SICE',0
$ s. p  ]0 F: f' P2 z   push    eax# z) X$ W1 J% a0 L( I
   call    KERNEL32!_lopen
& r9 P% [1 _; Z9 t$ o   inc     eax$ z( _6 d0 P- e1 L, g
   jnz     00650589                  ; detected, r& ~+ ^* [  M3 y; S9 {! {& ?
   push    00                        ; OF_READ
! ~- Q* v, B: W: m   mov     eax,[00656638]            ; '\\.\SICE'
4 `# g2 ?. Z: b' n; @   push    eax* A: t: B9 L5 I. i
   call    KERNEL32!_lopen4 x2 S7 [; w1 P
   inc     eax. d0 [! i- G3 g; M0 j3 H; ?7 e
   jz      006505ae                  ; not detected
, e# k6 m7 U2 h' ]' i4 e' b6 y5 E& h( h- T8 z

' n, `5 e5 H2 L; `7 P__________________________________________________________________________  [  e+ |5 T& e$ y; q4 A  i

* i- }8 g5 h( a; L- L6 ~9 v: l6 F4 a$ ^Method 12
$ R& c) c) s& f+ V4 {8 P; k=========
6 |# q5 K: R) W2 x, Z* q; W- {7 w' o6 Y0 k) l
This trick is similar to int41h/4fh Debugger installation check (code 05' v" l2 ]9 U1 U' M0 Z
&amp; 06) but very limited because it's only available for Win95/98 (not NT)9 ]% w: k" L: M" a4 F& ]4 [: v! u# I2 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.+ \8 q+ f) S+ s& I; r3 |
4 [" A( \3 ?- w$ |& e3 D8 Q
   push  0000004fh         ; function 4fh) R/ F, m9 N- v: K
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ j- N6 F4 l3 x0 c  f" U8 v# S
                           ; low word specifies which service5 }1 v1 u( R7 f
                             (VWIN32_Int41Dispatch)
+ d9 U2 ~. }; L7 |# i& h   call  Kernel32!ORD_001  ; VxdCall
8 ~9 A  Y9 u  w, O8 A   cmp   ax, 0f386h        ; magic number returned by system debuggers6 Z1 ?  x) M  ?
   jz    SoftICE_detected
, e+ t" i3 g' J7 t
* o+ S9 b2 g" BHere again, several ways to detect it:! N) ?. K2 r1 a0 Y9 E8 q# r% p" i
" c/ v' j( U+ t6 d; Y
    BPINT 41 if ax==4f9 Q' K0 `2 E8 @( S* P3 a  V/ C
$ w9 K8 j' i7 ]5 t
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 C) O7 i3 J: U; d. T
, K: }- p. z5 P0 c5 u6 ]% |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& J/ b# u  M/ g9 Y5 b9 R3 b, k" [+ S
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 W; P( S+ a$ J9 H9 t
0 L) r) \. h/ ]7 {& |
__________________________________________________________________________- l  K, i: h# A6 M! N7 f, ]- T2 L

2 X5 z# ?4 V) T; a  J& C) TMethod 13' A! X7 F2 b- E& w8 i" u
=========
; J  x+ }8 r  o0 P, y  R( ^
4 a& d: Y3 ]& c! GNot a real method of detection, but a good way to know if SoftICE is
+ R' ~" q! X- S4 _) I8 u. |; pinstalled on a computer and to locate its installation directory.
0 o! d0 g# }" U4 G  CIt is used by few softs which access the following registry keys (usually #2) :2 e- Q+ E  e% `; b: b

* z  i* [1 v4 g/ t-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 \* A6 N9 N2 V# C8 Y1 j+ z* }\Uninstall\SoftICE
, D- A) b) P) g3 q& W7 D) {1 i+ L1 `-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
6 V0 e/ T7 g4 l) Z* a-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( K$ v7 h5 R, a! f  @\App Paths\Loader32.Exe
, ^( N) H# G5 M+ I5 l
$ ~3 s: U- ^8 }, l3 H, s* p5 n1 E
, U. o1 f5 ]( N+ WNote that some nasty apps could then erase all files from SoftICE directory- J/ l- ]% m/ R$ U* E. m* l0 W
(I faced that once :-(# b5 t' h/ ~, l$ }$ U
/ P; d" z% n/ s. r9 _4 |
Useful breakpoint to detect it:
; t. K$ H6 Q: Z; e' |- x7 \
" V, ]  n. K! u* _0 Y: Q+ ~, b% `. {  P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! E( m% ]# W1 [3 v# j) q
* A7 M7 a1 M7 e, \( Z4 c5 j8 U
__________________________________________________________________________2 |+ j7 R  _% f0 y

5 k- T3 B: w0 }' @$ L4 a' t" l8 f9 I8 k2 s! T9 b+ L
Method 14 8 Y2 i- O) I' b% Y; h- ~6 D- T
=========
: L: b2 K( V9 o7 e  ^0 G
. r8 _7 a' Y" t- Y6 A/ vA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose" E; m# d( z# o6 c) Q) f$ [
is to determines whether a debugger is running on your system (ring0 only).
- R, v3 a& n& a1 X5 e+ D: p; A* h4 A8 x: o4 H$ T4 ]* j. X" {
   VMMCall Test_Debug_Installed
: l2 x& \8 h) E0 p   je      not_installed4 J/ ^* T& O5 i: \: R+ {+ p; S

$ o$ F, i# Y3 ]/ P* h& b, t: NThis service just checks a flag.9 Z' H; `8 O  |5 R( @4 v1 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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