About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
( z( I9 y) o" D3 n4 ~<TBODY>
3 c. O8 e% P% l. q8 q( |* p<TR>
- f- M* h  Y- m5 u2 Z/ C7 T8 F" K<TD><PRE>Method 01
. H1 y/ l, F+ f" A! d0 l6 {2 q' x3 I=========+ h; W: U. e$ F, V( Q

( U! c1 h6 ]+ t, j- j& F+ hThis method of detection of SoftICE (as well as the following one) is
* `/ E* _8 Q8 h% N" ^/ bused by the majority of packers/encryptors found on Internet.: ]! |, b7 E; Y6 Z; a" Q% @9 S
It seeks the signature of BoundsChecker in SoftICE& m2 T+ \( u' L/ X' a
1 w# P8 J3 r* Q
    mov     ebp, 04243484Bh        ; 'BCHK', q! r% a( \$ M2 R) I8 ]
    mov     ax, 04h% l8 {3 z) a. h# k/ m' |* j- Y
    int     3      
' a2 ~8 a, T  ~3 H: `, H4 m    cmp     al,4+ N$ f) w/ h+ G- O
    jnz     SoftICE_Detected
& X& b" O6 u0 {- p& z" y3 {( E) e2 W4 h
___________________________________________________________________________
" C0 P, g; r# x: f# y3 l: v6 q- i
, c( C+ B( _& e9 d, KMethod 02
) R  b5 b0 |( m2 y7 [0 J( Q' _=========: \  ~5 e! r, D" j! [( ~

9 p  B( E7 P9 Z5 _Still a method very much used (perhaps the most frequent one).  It is used/ ?6 N* c" [5 D/ `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  l& ?9 `5 L, u  t' dor execute SoftICE commands...) h) T' `2 L( ^" q
It is also used to crash SoftICE and to force it to execute any commands2 S- x6 V3 |, _7 \
(HBOOT...) :-((  
. ~5 _& J. H8 G" X3 @$ h1 z) \+ Q% |4 `/ ^/ Z9 ?3 W
Here is a quick description:8 x0 y, P8 m* ^1 Y/ N
-AX = 0910h   (Display string in SIce windows)# m% c5 s7 R; H' R$ i0 V
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 t$ q: r4 e( F! W-AX = 0912h   (Get breakpoint infos)
2 N: J8 N. p4 s* q$ c0 s4 A- `-AX = 0913h   (Set Sice breakpoints)& k3 ?; _7 ]! M. |' `6 f) @
-AX = 0914h   (Remove SIce breakoints)9 a. ^5 v5 r3 i( P% p3 }
) `7 j1 \0 l$ _) s7 r
Each time you'll meet this trick, you'll see:6 t' o4 \( k" d9 I8 f6 }
-SI = 4647h4 \, Y  O) k! s+ Z& ?* o" U# Y
-DI = 4A4Dh
  z8 b+ d9 V8 S2 A$ C/ jWhich are the 'magic values' used by SoftIce.4 J  W; B) @) w
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 H4 y% ?; k/ K) ]1 s  D' t, e1 ]

; `; ]/ E$ {" vHere is one example from the file "Haspinst.exe" which is the dongle HASP
  B+ ~7 f" o5 v( n9 _8 _Envelope utility use to protect DOS applications:( ~, u/ A& F# |9 j, H' d" A
& e& ~+ v& E1 @- o9 U- S/ f5 s- x

' p2 d) t3 \1 U" p4C19:0095   MOV    AX,0911  ; execute command." ?, H+ A' B/ _
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 g# E# s2 y' _7 i5 G% _
4C19:009A   MOV    SI,4647  ; 1st magic value.
( n( H/ @) Y" x  M5 v4 _4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 u# ^5 E4 u# I( V" _4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
* g! u! v7 U  B6 W- o- d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" N/ L6 @: j8 X/ O1 N4C19:00A4   INC    CX
. P+ s4 Y7 J: p3 s3 i' ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ f. }7 z2 g; S+ l: b+ Q* H- g0 I
4C19:00A8   JB     0095     ; 6 different commands.
( r  O% \% O# D7 ?. T4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& |7 R5 C8 C: p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- e+ K8 L8 H8 n6 ]' R  Y9 M# \) c) D/ r3 r( \) z1 k% ]$ D
The program will execute 6 different SIce commands located at ds:dx, which
- P# d& }" }; ~5 [: [' |; tare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 ~7 `( ^2 J7 M; P0 y1 o5 k
2 V  \9 w" Z) z2 h1 W7 a3 _
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 z* S/ ]; p: A6 S3 z* ]___________________________________________________________________________
9 `4 n0 ?; ]9 N9 h
2 Y( c( d. j5 W* c
- I, h6 `0 P1 c! J: PMethod 03
& X4 t/ v5 I1 @* Y=========+ B6 C  s, ?  a% R9 i
  ^# ^9 @/ i+ q3 {0 ?; |, R
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
- Y, |8 i. s8 S  D+ U(API Get entry point). u/ `; W7 I  m1 d% B
        
" T6 _: n2 t7 G: V+ c* ?- {) @( F$ B
    xor     di,di
- c2 W, x4 X+ ?$ j! r$ H    mov     es,di
$ r* y3 h! X2 J& e    mov     ax, 1684h      
$ R9 g! V0 J/ a5 }/ B4 e5 h( r5 S    mov     bx, 0202h       ; VxD ID of winice, ?6 F+ g, W0 E
    int     2Fh
6 T# I+ H5 G3 G# o$ S" r1 p: r* p3 B    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 O/ ^$ p8 x% d# J$ f
    add     ax, di
- f2 z) D; i' N0 Q6 G    test    ax,ax8 {6 {/ x5 |6 X4 {$ [% @1 {7 `
    jnz     SoftICE_Detected8 I5 F$ D) y' n: c; b
7 P' U* @/ s/ `5 y/ g2 u
___________________________________________________________________________4 S  x+ V0 l% I% @) X# R
% z7 o# `& f& A: i
Method 04
) n& o1 d+ W1 ^=========4 a- ^0 R( X  b

  p8 [% \3 P+ `  r  q8 h% vMethod identical to the preceding one except that it seeks the ID of SoftICE/ [6 X5 S0 G8 c7 j) U1 I; S
GFX VxD.
- M& ]: \- [6 H- ]( D
; J7 Z& Y( `& b$ \/ I    xor     di,di, k( M; K0 U5 V3 r  R7 Y# _
    mov     es,di9 x1 ~% M% B  O1 ?$ }
    mov     ax, 1684h         s" M5 U: s( m$ a+ M+ {0 C
    mov     bx, 7a5Fh       ; VxD ID of SIWVID% b% {7 c% h1 D# j6 B* j$ {* o
    int     2fh
- P. u, m% S: K    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 X% _+ C; U7 g    add     ax, di) q' y- p8 C( V% a4 \
    test    ax,ax: p$ m7 h: {$ U- O% b" [
    jnz     SoftICE_Detected
: V( k% f5 o8 h4 L  w4 }+ ~! g4 K$ R" m# ^
__________________________________________________________________________5 \4 z$ C' z; l: Y( N

0 ^3 K/ v  Y* B; C- ~. Y! E% r, [' B- m* D1 _" e# c
Method 05* w; d: q: C& Y& A# k9 t& M% h0 P
=========! t7 B# x# d- z' n

- z8 q# T- R2 k) ?Method seeking the 'magic number' 0F386h returned (in ax) by all system
8 ?2 P: m1 s, E& F( h- Y# @debugger. It calls the int 41h, function 4Fh.' ?6 G9 L+ Q  Y3 f! `" [
There are several alternatives.  " `" e+ r6 m" ]: Q+ D/ R8 q
3 u7 G2 p3 H4 \+ W9 V% h
The following one is the simplest:
& _; K' R3 o' a8 f8 s) h; e& r6 Z2 {1 t( w( P: M" {
    mov     ax,4fh) i8 Q7 u5 |: l) @+ i' r! R1 W$ T* [
    int     41h
: R/ I2 C( T7 M5 T) H' U( o  @    cmp     ax, 0F386/ b6 s' e4 ~+ W( r$ [
    jz      SoftICE_detected% u( \8 D8 Z' M/ ?5 Q' b2 C

0 {" O& {1 q% B" c& L
9 c. ?/ Y& U. S3 R1 E/ N0 Y' }Next method as well as the following one are 2 examples from Stone's
* J9 ?# R9 \8 t7 K9 L" `; [$ ]"stn-wid.zip" (www.cracking.net):0 b1 ?' ?8 M3 V' Y5 A

; U4 {$ j# u: |0 p- r9 v0 r3 R' [' b    mov     bx, cs2 L# @# T5 R9 F% q* o
    lea     dx, int41handler2
; F" ~. `) I/ L$ U0 w% C, m3 g    xchg    dx, es:[41h*4]
6 g' B; B# }8 a* }" L9 x$ E    xchg    bx, es:[41h*4+2]0 k- B( Z  A8 T
    mov     ax,4fh5 \- P8 o% p0 E% Q  n" G/ J% S
    int     41h
" `$ P3 C7 p% Y    xchg    dx, es:[41h*4]0 h/ J8 C( N0 p2 A/ J
    xchg    bx, es:[41h*4+2]7 \7 F2 y* V4 }" f4 j
    cmp     ax, 0f386h  C, G4 ^9 E9 E
    jz      SoftICE_detected  q  v& Z' o$ K' _4 ^# Z- `6 t1 E
1 b7 S+ a4 L8 o- D- G
int41handler2 PROC( Z7 H/ K, b: y+ v
    iret
  w5 l" ~% y8 oint41handler2 ENDP' [2 L  O, P9 y* d
9 S! ~: ?! I: E- t9 b
3 r! R! @  J, x  `7 f, m# J1 q
_________________________________________________________________________
3 E9 V$ @/ `6 P( Z% |# p9 h! @! m0 V) T9 v
+ u/ u1 S6 w7 _0 M
Method 06
2 o/ g8 u& C& n=========
# X: ?' M6 F7 c) d
. i4 `4 o" i/ ^' l
! A: Q) e+ z. Z& m5 v2nd method similar to the preceding one but more difficult to detect:
$ I5 t7 R. C, k2 c# c5 z: Z* K  @% I3 \0 {5 y
% u% n  ], j- ?
int41handler PROC
+ W8 N  z, T' P4 z+ ~9 [( W    mov     cl,al
; a  w9 m- Y3 X    iret1 h1 ?7 Y* C; e" q5 F
int41handler ENDP
# ?* A6 i! Q- N' n  E. {8 Z% {- ?+ _4 ?, l! d9 K' u

, A; K* f3 k7 m0 Z  j) e    xor     ax,ax
9 Q& l( ]& C0 M" v& c! e    mov     es,ax9 Q3 e  B/ b9 y5 I& V' R
    mov     bx, cs) \% J2 D; w" g( S3 i  B7 g9 J
    lea     dx, int41handler  E. c% q0 S! C5 \3 l
    xchg    dx, es:[41h*4]6 a& s' E7 ]* Q8 E) N
    xchg    bx, es:[41h*4+2]
. ]/ P0 }* F7 I% r3 T# _    in      al, 40h4 E, q. B4 r' k* E3 q0 f
    xor     cx,cx
3 g. m7 |1 R) ]8 r! J$ B    int     41h) n  \. ?" e. x( B; p. e$ z
    xchg    dx, es:[41h*4]
) r' g' ^' {/ |2 r7 U. K    xchg    bx, es:[41h*4+2]" l7 c' r8 s: ]5 `7 G. n/ W6 m8 x
    cmp     cl,al
+ ]/ _' [9 m" e( q2 L    jnz     SoftICE_detected
  A1 T0 L2 [2 h+ g/ ~6 R9 x, V/ }! l  k# j% Q
_________________________________________________________________________
) `' h" `/ q5 r1 b
& r4 y, H! o9 u8 i2 `9 {/ JMethod 07/ U. q# z' g% M
=========' b3 T: c& \+ x4 \

6 N5 G8 Z* m0 b# kMethod of detection of the WinICE handler in the int68h (V86)  z- g, X: K0 U: V- c7 p( J# S  Z4 A3 ?8 ^
/ H5 a+ ?& ?2 E% |9 g# z. l; ?0 c
    mov     ah,43h' J9 Y# |2 [0 ~8 ]! @# i- g) B
    int     68h" S7 @* W' X  c) a- k
    cmp     ax,0F386h+ B9 z5 F8 c$ E
    jz      SoftICE_Detected
/ ]1 D7 w0 w' M* i% P. \  u- y0 a* j' n  _3 x+ U: s! y

" `1 z6 A* D( V/ L: K% @) _=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit7 L: X  W1 V8 B4 R6 F+ F
   app like this:
4 w! _4 K9 o/ V* j# D
& X3 L3 P1 o6 C( g; y' @" A( f   BPX exec_int if ax==68& v* O- _. Z2 a2 N
   (function called is located at byte ptr [ebp+1Dh] and client eip is
. @$ M% P3 L5 W) L   located at [ebp+48h] for 32Bit apps)# n! I7 ?- s3 X+ g8 z
__________________________________________________________________________
% A. [* c7 {; K' D$ B- r
1 s, Y1 b! U  r6 B& k& ]: K- h, c+ l
Method 082 J; K, {2 P$ ~, j
=========# Y" ^  v+ N4 f/ J' Q

. x7 M9 z% w( LIt is not a method of detection of SoftICE but a possibility to crash the
; y8 D) A- O9 }+ gsystem by intercepting int 01h and int 03h and redirecting them to another0 y* r  S" ]) E4 L2 ]5 u1 u5 o* j* u
routine.# p, F3 o5 E& ^0 f( N* Z* v
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' {' h& C  s5 P6 H, f
to the new routine to execute (hangs computer...)2 l( d+ T% Y) q+ @

- U- l3 ~9 b" V" `5 H    mov     ah, 25h, e& L, N+ c# g4 @0 W2 I: n
    mov     al, Int_Number (01h or 03h)
3 i1 u. M4 R7 o6 B/ C( U0 t4 V" R: B    mov     dx, offset New_Int_Routine
5 B% b; r7 z4 }3 U: ~    int     21h  O- w, q# p; ~
" R  z4 O- G3 Z. i. Q: W5 P0 O3 Y
__________________________________________________________________________' E) h- T0 H( C* m; |

' w8 r& a2 J  i! Y9 M, SMethod 09
) i5 T( P$ f4 `  b0 x4 Y=========
+ W: J. Y- P- y( R# O+ F
% |3 n5 N6 g+ z$ nThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
* s  T4 q4 X* L4 N& uperformed in ring0 (VxD or a ring3 app using the VxdCall)., T$ g2 m5 S8 T. `! r4 L
The Get_DDB service is used to determine whether or not a VxD is installed4 V- `' U0 d0 C
for the specified device and returns a Device Description Block (in ecx) for- z4 s: Y! Y2 N0 b5 D( F
that device if it is installed.9 c' m: y+ s5 `, |; m" _& r5 e6 b
6 e2 n: h% v3 F# f8 [
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! w2 M: a7 x: _. ]0 ^   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 e7 z4 ^& S& r+ i4 z# A  h) m' r
   VMMCall Get_DDB
1 D" c& r7 _9 R* t* v# d( ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, h! [5 L5 U; Y4 n# H5 O7 _  v. a5 f6 |9 \* ?! L
Note as well that you can easily detect this method with SoftICE:/ ]! z; T1 D) O) z3 N. V
   bpx Get_DDB if ax==0202 || ax==7a5fh3 j  _0 E3 n# D, x1 L

* s. K1 v: k& _+ X__________________________________________________________________________" r! w. J6 k7 U* B& w; ?; o

0 \8 [1 D0 t& j, l2 ]Method 10) ]6 Z7 X5 V2 V" G9 b3 n4 N
=========
, }3 J! g. d( _" j) z+ c) e1 R" c3 D2 M7 w" {" }1 \# E1 L
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 d3 W) X# y  E( d6 P5 M- Y, E+ K& _
  SoftICE while the option is enable!!5 ]* h6 M9 x  _: m# ?

9 W. S+ A; f. V) H  VThis trick is very efficient:
+ H2 h/ N! r# u% S& K0 e, Vby checking the Debug Registers, you can detect if SoftICE is loaded% x% q# g7 J% q+ C& O9 q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 h2 b  j( C1 F+ a" f7 `
there are some memory breakpoints set (dr0 to dr3) simply by reading their1 M; t" {7 j  Z
value (in ring0 only). Values can be manipulated and or changed as well
/ N7 C4 B) ?1 B(clearing BPMs for instance)' b: W* ~! N" L* g) ~' a, q) q
8 [% X- V5 Q5 o. c+ V' p
__________________________________________________________________________. n* y1 F& w; m! L0 }9 b0 ]

6 ]( c% N" P! X- s& a/ |( k9 y% t/ F6 bMethod 11
8 G$ z% d) P/ p9 d, }( y=========
* M% A7 r5 T/ U3 A3 _6 W& E- Q, s- a% |' h
This method is most known as 'MeltICE' because it has been freely distributed5 V# s7 T4 ]$ h) c) q; n( w6 x; D. ]
via www.winfiles.com. However it was first used by NuMega people to allow1 _; S- |) N0 p1 F+ J9 t) t6 E
Symbol Loader to check if SoftICE was active or not (the code is located
( e0 I5 R& x& C7 m2 Cinside nmtrans.dll).! W. @" T$ K! ]: l# A, B1 G* P
/ b$ y* L$ ^( p8 [+ ?
The way it works is very simple:, W" S  s. D; U5 M- l8 d
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" y5 f8 H2 y/ d0 A5 I
WinNT) with the CreateFileA API.6 l' O3 }( M; i7 P+ O- [9 e: E

  X& D5 w0 i/ KHere is a sample (checking for 'SICE'):
0 O) Y3 s( k* k' K' Q2 ]6 b
5 X' P# H8 u! ?, ]1 O! u7 KBOOL IsSoftIce95Loaded()
5 _% }- k1 F  h/ B{5 D- R# }5 A! L5 j
   HANDLE hFile;  
6 f1 m7 w  t8 l5 t3 z  ]; x   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' U# ]8 c! g( q! r) a9 h                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ K- [. ^- J; H5 k, n* T  z( H
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 o' I8 i; D' p. u  x7 |. z   if( hFile != INVALID_HANDLE_VALUE )9 C2 q- G) ^6 X, F( L5 B
   {! ^$ Y/ ^& ^7 K: n
      CloseHandle(hFile);$ J% M8 n% y6 y8 h7 H
      return TRUE;
4 E: M' W* F0 b% ^  n  }3 Q6 I   }
0 y, x4 z  g9 g   return FALSE;; M4 F/ V% R& @8 }; F/ U9 `
}" p, j* l4 V" Y( S. y0 h, Y8 `* j, s
0 i$ G) J  l; {, @5 ]
Although this trick calls the CreateFileA function, don't even expect to be
9 Q# k* H) ~2 |3 qable to intercept it by installing a IFS hook: it will not work, no way!
0 n, _) e! x) V; kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
- P) M& ^: N4 i$ c8 `  X, Vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# {* Z3 [+ H9 J" xand then browse the DDB list until it find the VxD and its DDB_Control_Proc
, u, K, V, Y8 ?: E; j% t" a: r* Ufield.
; b. W5 X, B5 Q4 |+ \2 SIn fact, its purpose is not to load/unload VxDs but only to send a
! T: V- y/ j2 Y" tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; Z! e  L8 J  k) g7 x4 [to the VxD Control_Dispatch proc (how the hell a shareware soft could try( ~" I2 u2 M" l: }
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
. h6 t% m( m$ g( YIf the VxD is loaded, it will always clear eax and the Carry flag to allow
: [9 r: Y4 x  @( @its handle to be opened and then, will be detected.* m" n0 l3 S1 A/ I
You can check that simply by hooking Winice.exe control proc entry point
! V5 K6 m% W- F+ Z5 gwhile running MeltICE.
' o7 ?! G/ K6 {. ]0 y+ }; `" S! S' k. m+ }% o2 S" N

6 G+ [8 n  v) \5 {  00401067:  push      00402025    ; \\.\SICE8 O0 m& }- u( {) b- H( p4 z
  0040106C:  call      CreateFileA
4 m. g' U+ j* P  O$ u+ @) Y. }3 _  00401071:  cmp       eax,-001
$ y0 P" @, Z2 f0 d; l' q  00401074:  je        00401091
3 p# N9 G6 B7 @6 t. r6 x: `' R5 |; s' {' c* Q7 G& f9 \

5 j* E3 J8 x6 y% cThere could be hundreds of BPX you could use to detect this trick.
; G6 G: B5 ]& @1 y. L( h-The most classical one is:6 u% {0 _! Q0 n& [* q
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% i5 [: T% z- z" y  O# m7 x1 n
    *(esp-&gt;4+4)=='NTIC'
* G/ A8 {: Q" h4 A  x5 x
0 i" [' n& `  H3 P-The most exotic ones (could be very slooooow :-(' n- l1 x: b7 n5 [6 f7 I3 z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
/ h/ }" f, g* ?$ s; \2 T6 ]6 I$ R5 o     ;will break 3 times :-(
9 `4 Q3 D/ n7 l5 ~4 K9 z& Y: ^- [7 b4 k4 P0 C  f# y" Q
-or (a bit) faster:
" e- a# y) b- F. T+ g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 F& a- b. h( R+ H  M
- G, }# M/ u+ z- {1 \! }/ f   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 T9 m- K# j: ]" c+ h     ;will break 3 times :-(
( O4 e6 F3 W6 H3 o2 z- P7 w% _
! ^" z- q  a1 \0 D-Much faster:7 r. i' J* e) s) V
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 z5 z( Y6 L' t; I

$ B& s* h; F  d& M0 x2 w2 LNote also that some programs (like AZPR3.00) use de old 16-bit _lopen* F# [6 U1 s2 e
function to do the same job:- n) [% _! Y- U' N8 b/ j; [8 u
/ ]8 N1 e" b7 m
   push    00                        ; OF_READ
: K2 R, k% |) \" J7 z4 \2 v1 f  C# e   mov     eax,[00656634]            ; '\\.\SICE',0
, U9 f( d4 C7 U* `& k* @, b   push    eax# _% T* g- W% E; L8 G4 e. w3 I# l
   call    KERNEL32!_lopen9 k: t' z7 ?* e7 v9 I
   inc     eax- r; x% {8 H4 _# g9 \
   jnz     00650589                  ; detected, d9 A* B1 h8 q' `
   push    00                        ; OF_READ
2 i. ?' P6 N4 u+ L1 f+ o$ V/ H   mov     eax,[00656638]            ; '\\.\SICE'
+ H" A& T9 B. U7 L, x  [   push    eax
* ~7 T$ n! [. _   call    KERNEL32!_lopen
  D6 r) d# F2 t- \+ o   inc     eax
$ t* I/ B  ^, ^8 O% I   jz      006505ae                  ; not detected
9 f7 B; V( F  s
3 _8 a  \. I, B: G
4 m5 Q, c8 H/ b' m8 V) x; T2 R" t__________________________________________________________________________# h) o- \# n. v' E

3 _8 O9 `- ^5 FMethod 12# f* b9 s0 q* w+ ?! n
=========1 Q2 i& e0 f2 e, S" m  M

5 l0 E6 l+ w9 G$ @2 a- g1 @: yThis trick is similar to int41h/4fh Debugger installation check (code 058 }- j# k: Q" `/ B: L
&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ O* i# e, ]2 W, \4 y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; O. C( _% \! q# [$ v$ s+ U8 l
- \! k5 ^  M* t5 Y/ ~5 q
   push  0000004fh         ; function 4fh( \- z* ?' ]) h5 |9 m* w  O9 ]0 A
   push  002a002ah         ; high word specifies which VxD (VWIN32)! w0 l2 R' ]) g, ^& v
                           ; low word specifies which service
1 H1 k9 P6 U3 L& d+ I+ D4 a                             (VWIN32_Int41Dispatch)
4 ?. a- u$ `1 s3 U9 J   call  Kernel32!ORD_001  ; VxdCall
  O, L7 |3 v7 T   cmp   ax, 0f386h        ; magic number returned by system debuggers
! ^8 W' U6 m5 v6 r9 l   jz    SoftICE_detected
" E3 |" t* \# n! m$ t. w, [, }
- Y" @* x& v) n0 R2 J' [Here again, several ways to detect it:
1 p$ X" Z8 Q* c& O3 R5 v6 Z1 p" l2 n6 O6 J) b1 C5 t3 r
    BPINT 41 if ax==4f* ]' I' d7 K3 ]0 M; r

/ g: |" z3 N- F& D    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one; P# N6 V: A- B5 r

. J1 x- h; V% Z  V9 e    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
) D6 K8 p2 l2 ?# ?  u$ ]" b; A1 I
- G# K6 I9 e& z9 _. s+ S. G# O: ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 {0 |' M+ }4 \! V  [
9 K4 Y( c! e% }5 u' W4 z__________________________________________________________________________7 o* y0 ]1 U' Q0 i% k4 E* T; s
" B) L* ~1 u7 ~& L
Method 13# w# L: A; M3 E$ Z9 k
=========$ ?: K3 K, B: O' V$ j
* |: p+ s* e' V9 I- i! w, t
Not a real method of detection, but a good way to know if SoftICE is0 x7 z! [) ^0 Q3 b3 T! V+ @4 A3 z
installed on a computer and to locate its installation directory., E# t! \0 m. Z
It is used by few softs which access the following registry keys (usually #2) :
; h. _; J* H" U! k( N, G% c: a
4 _' ~' l, f; g0 F- w2 x0 r4 F6 B" i-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 q5 W+ H5 R: ^2 V\Uninstall\SoftICE; W0 u2 J" N+ P" a$ e* e0 s
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; [9 b. @  o( Z2 P4 T( H0 A
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! o/ J, g1 e" M% I5 ~
\App Paths\Loader32.Exe
8 W8 q4 M  g0 }& r5 Y% O5 ^8 \- T0 c

0 I; g4 _1 [# MNote that some nasty apps could then erase all files from SoftICE directory/ l  @# u2 E1 U3 u! Q9 Q
(I faced that once :-(5 S1 x0 I- Q- p' h5 ^6 X$ f1 j! S3 O( B

. I$ `5 w. P$ D8 B& Y# bUseful breakpoint to detect it:0 b/ {1 z: V1 y, X- b

( C  n3 R# Y$ ?- u% s) u+ |     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. B& z) ?; Q, f- x
6 ]3 S$ z4 Y% o; A3 ^5 D" y. r: k8 L
__________________________________________________________________________$ _% w0 x  n7 {

2 f' m5 \2 a  f. s' u+ ^9 h8 K. E$ u+ y0 G8 L; E# e. B
Method 14 ) ?& S8 f+ v3 x9 o! ~
=========
# T) z7 o( g3 X# R* R7 n0 n+ K. k7 o! q
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* @- P/ F9 P" H8 T" s7 Ois to determines whether a debugger is running on your system (ring0 only).
% a& `3 x6 g9 k# I% T
/ {2 s- o1 D* E   VMMCall Test_Debug_Installed
3 G3 v  R4 O& I6 i. j! B3 n   je      not_installed- n" `5 M4 W: R0 g  V8 K; O
3 Y: a$ `7 _8 i: }2 `
This service just checks a flag.
8 b0 B5 |/ [7 I8 U8 p& S1 A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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