About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, c: w4 i) {; k7 B3 ?<TBODY>/ S: b  i8 ?! y' J# P4 m
<TR>( o. e5 c/ C# Z& ]
<TD><PRE>Method 01
2 E7 P, `+ ^. b0 T9 w  ]=========
; q; p) ^6 \2 J% w
; @$ u& n! W* C, `! E/ ?This method of detection of SoftICE (as well as the following one) is
! [7 g8 N! w) {7 Hused by the majority of packers/encryptors found on Internet.# P/ O, L' g: n$ v
It seeks the signature of BoundsChecker in SoftICE) R$ }4 x7 I7 D7 C; R

: P! e4 l5 c6 T* j0 J2 o    mov     ebp, 04243484Bh        ; 'BCHK'
. [! l! A7 Z, A' p, [" Z    mov     ax, 04h) Y) a; w, H5 ^- |7 {
    int     3      
1 m4 c8 O1 |( F5 C    cmp     al,4
# N" A, t9 ?- x    jnz     SoftICE_Detected
$ e; w9 H. N, v2 @' H3 Z0 }; O& M: u1 I- ~9 j
___________________________________________________________________________1 |6 M- |! ^; }; F3 J

3 F. |& K1 n! p$ `Method 02
4 D4 X9 r1 ^9 A! c7 i4 t! ^=========. i' I: ~0 G. K  R6 h: q) p4 S

' K) S9 l  W9 l+ G* R' f) f& QStill a method very much used (perhaps the most frequent one).  It is used1 f, L% Q; H9 r! N, t1 V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ r8 ?3 k$ ]* @. f& a4 h% M
or execute SoftICE commands...; j: q5 v$ t/ t
It is also used to crash SoftICE and to force it to execute any commands
$ k& k0 W6 m+ M; v( h# @(HBOOT...) :-((  
' l, v: ^" ^1 N3 k+ b3 @
+ k8 I, J3 V; C9 RHere is a quick description:' p1 |7 Z1 W# Q# Y
-AX = 0910h   (Display string in SIce windows)
0 A5 X: w& U* ~9 M5 N-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  I* X# M. w- e* q% @! G-AX = 0912h   (Get breakpoint infos)
  ^$ l; G4 W' y-AX = 0913h   (Set Sice breakpoints)2 o5 m8 f" J5 d$ d0 h7 O. ~! V
-AX = 0914h   (Remove SIce breakoints)7 _# V3 |" ]1 i1 n1 F

& g. {5 @% B6 X, E7 \4 w' hEach time you'll meet this trick, you'll see:
1 S3 ^# Q: ~2 N2 t3 q2 C3 z-SI = 4647h0 A8 Y- @- q; ~% ]# v! \
-DI = 4A4Dh3 `6 ~3 L- d. W! k. R) i2 o
Which are the 'magic values' used by SoftIce.
5 e! _! y$ x# z% m" O" ]9 jFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ W2 N: o" j: x5 A4 C# w  N% h8 C& G
7 L. }* z  X9 ~$ lHere is one example from the file "Haspinst.exe" which is the dongle HASP
8 M, \/ i* I' N9 mEnvelope utility use to protect DOS applications:4 m  O6 [2 G% w& W* Y
$ I: M6 M4 l0 @6 _: m

9 \  G1 n0 y. j6 M- y4C19:0095   MOV    AX,0911  ; execute command.
6 b9 w' e3 y" h" D) n8 y, m: s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: ?  B2 X3 g& E; l! G
4C19:009A   MOV    SI,4647  ; 1st magic value.
' u( ?3 D6 I" I) I4C19:009D   MOV    DI,4A4D  ; 2nd magic value., y! C0 C# ~& `( g6 A' H' ]
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ r" b$ e2 R/ e% C/ F) Q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 B3 K1 m" Q. k. a2 T/ b6 u; F/ n
4C19:00A4   INC    CX( ?! h* @9 T5 ^
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" D5 `1 P6 n9 E! q/ ]4C19:00A8   JB     0095     ; 6 different commands.% A' _* Q9 C9 {0 ]
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: V% R6 m) B. A
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)2 X  y% F4 B( D. a5 g$ ~/ B

' j9 {! y* s( \The program will execute 6 different SIce commands located at ds:dx, which
6 W5 l) Q% b- |/ sare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  G* G# A- u# r
; A6 a. J' Z, v1 M5 B1 j  a0 K
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& P5 P* h/ i8 S0 N. N& {4 X___________________________________________________________________________; _2 l, U4 f- G3 K9 H8 Y2 J

/ B: k/ B! S+ B' G- Q" p+ N9 v) q  z& M
Method 03
) P. o3 M& A$ ~% C=========
" L: ]% i  P9 e8 p7 r1 g. o/ M% H4 o: X$ t5 f
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) Q7 l' S7 q4 N, ~  g; h
(API Get entry point)) W- G: R4 C$ @3 |6 Q/ C
        
3 J( w, H' D+ n3 R
# P) O/ \$ C+ R9 E3 d2 t1 L, R    xor     di,di& X& _% }: f$ ?8 `# O; Q
    mov     es,di
% H- f, I  U4 i, {) W    mov     ax, 1684h      
$ C7 S8 |1 T- c) J7 Y, u    mov     bx, 0202h       ; VxD ID of winice
2 k6 \8 L  g: l' n: D    int     2Fh; P1 h: ?8 m6 ?- `# S0 {$ [' Q( s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) J  ^) ?: M+ l. W/ N/ @9 N' G7 n
    add     ax, di8 T" b* L! d! O# T+ W! o6 Z
    test    ax,ax
9 S2 m7 f  x$ `8 m- q9 B. M9 T% }    jnz     SoftICE_Detected
. z8 n$ l: `$ @0 M9 r) Y8 ~' \( B9 H- f0 c: S9 M
___________________________________________________________________________1 w( z# N3 x+ t, D# Q
% _9 {: r9 q* S  X0 @
Method 04
9 W4 u% y" s2 N# D- i; _=========# L6 U' ]: x, X) b- O; j# q
, n. b6 e$ P* h1 E8 S
Method identical to the preceding one except that it seeks the ID of SoftICE
( {) f9 T* D& v$ z; d( ^4 }GFX VxD.
! d" O- {# E) B3 A' P
, {" H- Z) S, k    xor     di,di# S1 S3 ~  B( ]
    mov     es,di
+ r5 R" \+ H& X, E, v8 }    mov     ax, 1684h       9 n0 Z0 @8 a- t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
& h. G1 X" r- t, u/ Z3 F    int     2fh) Q3 N5 V. h! i2 B$ k7 d* [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 a; g' V; j7 @+ f
    add     ax, di% x" [1 r5 Z: a3 o  q+ A
    test    ax,ax" }: M7 y* u, N! A: Y% C
    jnz     SoftICE_Detected
9 C: |) X& l$ Z" @) n2 Z* N7 J. C1 f8 R) a! R' v" Z+ ?
__________________________________________________________________________& W9 e# q8 \1 G9 f* k

2 v1 T$ x( W- o3 X# J" t  i$ `- Z& |. {9 T
Method 05& J, r6 {! j- V( L% D: |2 }
=========. m# D* ?$ P9 @4 A4 V

- k$ m: E* E- A; u- R+ {Method seeking the 'magic number' 0F386h returned (in ax) by all system
/ ~! \! n$ X8 Edebugger. It calls the int 41h, function 4Fh.9 ^" A. K+ W- G
There are several alternatives.  * Z: }" j% J5 ~

1 l7 v, p3 \6 i% ^The following one is the simplest:
8 T1 M' l7 U, y% A! v7 @  `& O
) }8 r1 u* g+ V3 [    mov     ax,4fh
! |/ R6 E/ H( j7 |    int     41h
) O$ j+ b$ ^% R/ p$ D6 H    cmp     ax, 0F386
7 Q/ F. `+ Q# R8 d0 B. W3 S    jz      SoftICE_detected
( W' k5 k/ D1 e/ y. M3 z% a6 A8 M) q8 G/ D4 R

; K! T3 {5 ?7 D  H% g  X  i0 ~Next method as well as the following one are 2 examples from Stone's
* v+ z; q1 y/ m! w2 J- X"stn-wid.zip" (www.cracking.net):+ W+ n$ m  r4 k  A  F6 H& G

0 L1 d3 c5 R) T1 d/ N9 C3 {    mov     bx, cs
, \+ G" g2 j. z/ J    lea     dx, int41handler2, d  f, p  z  P$ _6 l% _. O  Q
    xchg    dx, es:[41h*4]! n, O) g1 @" k7 `7 r
    xchg    bx, es:[41h*4+2]
$ I2 g9 D1 M- p6 u    mov     ax,4fh; o6 P& X# F9 W) ]0 d! E; f
    int     41h. I7 ^  p* R6 n- m* ?
    xchg    dx, es:[41h*4]) ?" X& L$ B+ i5 o7 Z8 W6 i0 U  K
    xchg    bx, es:[41h*4+2]
; W% ]3 S/ |+ Q; J3 y0 z, i# r' T* u    cmp     ax, 0f386h
/ W  l3 q2 s$ X& k. {    jz      SoftICE_detected
2 o: q' G5 o1 n; X. z- y
1 d, v9 s, A: A8 ^9 Hint41handler2 PROC
) D8 M" U4 R0 Q; `; j    iret
/ U; k. A3 Z% p6 I9 oint41handler2 ENDP/ z( [# S4 S: B' `- X

9 u) R0 A& E: Z/ U4 X
- ?' d9 q0 @! ^$ R1 a_________________________________________________________________________% n/ }  }6 v9 h! q* r

# `+ t3 A- m/ S" N4 S% F
7 p& x( E/ j4 p9 @1 E" g; RMethod 06* C: H  V9 Q# _
=========
3 f5 {$ l8 p7 z; t# \& y4 L  K& }6 P3 C- V
: o9 C# {. F1 J9 M2 C9 U
2nd method similar to the preceding one but more difficult to detect:  k, }+ f; @- \4 U8 C

" q/ ?% Y% v4 ]9 {9 t9 I2 g4 ?2 y+ q# L* }
int41handler PROC
! Y) [/ F$ m* }$ L6 }    mov     cl,al
3 ]; L3 v5 i; z1 |$ `    iret$ h) F1 f  v. {* n& Q# V& u1 ^
int41handler ENDP  R; a/ F% W( Q. t# C0 V* B% H
* |' t; }2 s$ k$ a: I! c

) D( j! w/ k6 E8 _9 _* l- x' l    xor     ax,ax) S7 W& r0 T1 E& b
    mov     es,ax
% [+ S3 k$ i5 y2 @$ D0 ^    mov     bx, cs
- y  Q3 q1 G3 I    lea     dx, int41handler4 H% `# l( _, p; ^% Z3 f+ @& }8 f
    xchg    dx, es:[41h*4]
2 X5 B) X- ^6 G8 G" V" d  H    xchg    bx, es:[41h*4+2]" i. ]8 s' _$ l1 o% X, ?2 O
    in      al, 40h
9 a" u) \2 ?1 h: R4 d+ ~5 {( x    xor     cx,cx
) @" L, Q+ v( E    int     41h
7 Z# Z& i. [: U) D5 n) Z    xchg    dx, es:[41h*4]
& _, ^. e  Z. I    xchg    bx, es:[41h*4+2]
+ V: o. h6 w1 h5 A' K; V, E  S    cmp     cl,al
5 B  _8 c7 O1 _; y    jnz     SoftICE_detected6 Z5 J, e2 O( R
9 p- Q6 |% j9 F3 E+ v" F+ z" x
_________________________________________________________________________3 E7 X& \( v0 E9 \' ^7 f: u; s
; E. D) _  J2 d0 X( [) @3 M
Method 075 U9 @/ f$ e- k
=========
- T% @% O) X7 [' z* B, }/ ?0 v6 D- Y! O+ T, w1 V
Method of detection of the WinICE handler in the int68h (V86)
% Y( j  L0 c$ q& c+ I
: r, P, \4 N6 g0 M    mov     ah,43h
# u' w  N6 L5 T( j5 X% p    int     68h8 F9 J& ^6 M) F2 Y+ }2 [
    cmp     ax,0F386h
' F3 U+ L! }4 L/ j    jz      SoftICE_Detected* }& T0 _  g8 u" T! _

+ D7 t5 d( z8 z. S# m& W/ o% X: l  N% P* J) [% S1 t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& l4 e( i4 j& j- H& F: r   app like this:
2 F7 U. z* {/ T4 z+ I7 E# X- u0 ?8 v
   BPX exec_int if ax==68& X$ q7 ]( M9 _3 m3 ]/ q
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ l. C8 a8 R" S0 N% U! `   located at [ebp+48h] for 32Bit apps)1 I' F5 T7 h+ q" L
__________________________________________________________________________7 z) T2 q4 N6 o. _

, p0 b' Q3 Y( y% \! |. W% Z  L4 F, {. a1 q
Method 08  D0 |0 y$ x) E. ^1 k+ C
=========
: ~1 o+ Z3 Z7 ?, ?: [/ m7 }/ x! Z2 J$ s2 g
It is not a method of detection of SoftICE but a possibility to crash the! ^) R  p( `5 Y2 I0 w
system by intercepting int 01h and int 03h and redirecting them to another$ D: n( g* N/ j! b. B9 q
routine.8 T" j  ~! ]3 \
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* k( p# e0 T7 a3 e4 _, }& I& m+ t/ x
to the new routine to execute (hangs computer...)* I1 ^- x; L# [- F7 I' [( h

6 X- B' l5 e3 T5 p8 X    mov     ah, 25h6 P5 a1 V' _8 u; [6 n/ h% Y
    mov     al, Int_Number (01h or 03h)
: d% H  z# W  \# @: C6 B) w: r    mov     dx, offset New_Int_Routine
" O9 J$ L0 H/ {) E  B& C  ~2 l0 E    int     21h
7 n3 W' Y2 b" G. `$ o# d" b/ ~- _
) a# Z# n5 S' T  ]2 ?8 T__________________________________________________________________________2 S- i/ W# u/ b# x- z6 ^! G, J
) j1 X- O# o4 j+ P# S! A. D- g7 U4 ?
Method 093 Q% m1 e0 \9 ?" H3 O
=========
: I7 u# `2 r' S  _- s0 ]# v! I- c' A  q9 Z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) w& e/ F; S+ @performed in ring0 (VxD or a ring3 app using the VxdCall).' d$ m* t& Y1 }9 n7 y/ R
The Get_DDB service is used to determine whether or not a VxD is installed. @* M! y3 j2 ]+ _8 n* i- O3 _
for the specified device and returns a Device Description Block (in ecx) for' v; }: _: d/ |) D. O, s4 _9 a
that device if it is installed.: T+ K4 V& C9 o. x8 c
/ R% C' K% u. G
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
% Z% D6 @: J1 N8 Y7 K% L/ Q" @& T) @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 Y! X9 m; d+ _5 N6 I7 S2 j  z   VMMCall Get_DDB
% b- o* g+ E2 ?2 m   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 i- v3 ~8 x  r/ O7 x

/ D! U" d* L  u! s& ?" NNote as well that you can easily detect this method with SoftICE:3 m) C- W2 |/ a0 j) h8 k; E* r
   bpx Get_DDB if ax==0202 || ax==7a5fh1 L. O  {/ V- y, I+ q* e" z
7 a7 Q. f# Q6 K8 y3 A
__________________________________________________________________________
. \% R- l% Y5 h+ r% H+ v% y$ n: {( ?9 x# D0 H0 t3 R- \
Method 10
" f' W% J% }& G! N  _* g: [=========. M+ o! U6 ?+ {& t0 f8 a4 A
6 `6 i- K( C: ?/ ^
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ s1 {# w: ^) g3 O% Q
  SoftICE while the option is enable!!, }! M, {; y( s
/ V" B7 e8 n0 D) [5 I
This trick is very efficient:
( B" T( y7 ?) b6 Gby checking the Debug Registers, you can detect if SoftICE is loaded: ^- }' E( f8 o6 n0 G# H2 q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 W1 ~) i9 Q# l0 a
there are some memory breakpoints set (dr0 to dr3) simply by reading their
, K: ?5 O+ M0 c8 ^0 g" t4 Qvalue (in ring0 only). Values can be manipulated and or changed as well
: n+ m; X4 z7 B1 R, e(clearing BPMs for instance)
8 K2 [1 @# _7 p9 G
5 ^- v5 |2 Z( s: D. j5 |( C: z__________________________________________________________________________  R9 Y2 b, L7 f6 x: {$ r& m6 r9 J
# B0 S5 g4 ~5 @6 k2 @0 O  s
Method 11
- a& ^( \) P" i& S7 i. l4 D9 m=========% W$ t) _  y% x# |8 Z. j4 v) Z! _8 D* S
! J! p& E) K! m2 b
This method is most known as 'MeltICE' because it has been freely distributed
  ]0 ]6 G" [& X* n& Dvia www.winfiles.com. However it was first used by NuMega people to allow
# ~: v3 m( Q* l! a9 LSymbol Loader to check if SoftICE was active or not (the code is located
9 S" U1 H( v: D5 {' I# z/ l4 C, Tinside nmtrans.dll).
9 e- ?; Q' l; m# T; @; ?  y" o* @2 T! N3 `; S3 {! n: W- y  s: V3 \
The way it works is very simple:
$ m$ g: @% Y0 U" M# y9 j+ C" M  I4 }It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& D* \: |" a6 ^  L  A8 PWinNT) with the CreateFileA API.
% @( R5 T" Z/ T/ w2 G5 n
& x* T9 Q3 g+ g! ^1 o6 FHere is a sample (checking for 'SICE'):) W8 p" _# E# N. g6 W. ?

* W. l( F' c. mBOOL IsSoftIce95Loaded()0 D: N! ]% a7 m( @& M* D
{
! L  c1 M% D  X2 b   HANDLE hFile;  / d( g1 M  _1 P$ I3 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 q7 ^0 V+ `. n6 w& {9 e7 _& d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: Z' H# r! F9 v* I" T                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 H' V! m/ V# A1 e   if( hFile != INVALID_HANDLE_VALUE )
, @- `9 e. f# d  U0 K2 r  P% e   {8 a* o# m1 m9 ^7 f
      CloseHandle(hFile);
) i  D. d1 `; L" |: u9 T8 T! ?      return TRUE;2 W- ~# K0 F/ n+ L- x3 I8 B0 H" ~- I6 X% Q
   }
/ e; h" K: O" C# j; X   return FALSE;1 \! t% v+ N  |8 A& ?9 x
}9 J: O: ~7 v( [% s' x9 o

1 }: z3 R* u0 Y* U6 a) i# VAlthough this trick calls the CreateFileA function, don't even expect to be
2 v! ?! j8 K5 _7 h' u' Rable to intercept it by installing a IFS hook: it will not work, no way!
7 C( z2 [5 d' J" ^$ E5 s3 aIn fact, after the call to CreateFileA it will get through VWIN32 0x001F3 ~  ?9 h. ]# t
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# ?5 y6 o8 @. o- m8 H8 M
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 N" ~1 R' J( a% T1 o) H5 c9 I, d5 pfield.
# M) G4 w* a. ]$ `In fact, its purpose is not to load/unload VxDs but only to send a
# p  [; l, R) c2 ]W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- M9 h% i2 C3 J; X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try3 u+ V9 \9 |" J1 _3 A! y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
; d  [6 E) {: Q  ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow# W: h$ N8 D6 a' Y& U6 _# H1 `
its handle to be opened and then, will be detected.3 |) ?) T9 z, }- S1 O
You can check that simply by hooking Winice.exe control proc entry point# |0 I/ e1 T0 T. S
while running MeltICE.
+ t7 O7 O) x0 B$ p# n( W& u$ ?7 V4 p; n8 @) R$ q

& L8 d6 g7 P1 W% D6 @/ W5 `2 q* _  00401067:  push      00402025    ; \\.\SICE2 _2 Y  H% n) {9 i1 U6 H2 S
  0040106C:  call      CreateFileA
& O1 M$ W+ {0 m$ n6 @" e  00401071:  cmp       eax,-001% B+ B  r' l3 e7 g7 K, Q
  00401074:  je        004010913 f: G2 b1 a6 `
/ |0 X9 u% |7 D

5 X/ H; x' }3 MThere could be hundreds of BPX you could use to detect this trick.
) G% q7 ?. q# u  t-The most classical one is:* u: j6 t1 Q) G# V5 q% ~
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% R; w% p1 y: N1 d: H% E& \    *(esp-&gt;4+4)=='NTIC'" C8 v; F( y% g7 p2 h: J

# ]$ J9 H. {! W1 u( f7 }. }-The most exotic ones (could be very slooooow :-(
# `) [2 x0 E, z3 w, |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! w1 {( q- u) H
     ;will break 3 times :-(
1 o. r1 \* |; ?( |, h. z' Y' T; N5 I, j. f
-or (a bit) faster: . k) C1 K8 x/ z; n5 k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')8 ]6 v0 o* l" w" `

! G$ K0 u* {+ `+ C9 q" O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ ?% q; t8 ~6 Y2 Z. V     ;will break 3 times :-(
8 l8 J. u. k* }# s6 ~+ J
% v! `7 ^- J3 a( _-Much faster:
" q1 @4 J  y: J8 U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( E/ C' Y4 S6 L" d
- Q8 l* a  o, J8 L. e' t
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
- |5 Q* N6 B( J# k" O7 vfunction to do the same job:
/ k% W6 t  u0 A  ?8 {. w0 _4 G: Q/ ~: @+ j+ ^
   push    00                        ; OF_READ
' k0 `7 d7 ?3 j, N3 K7 w# C' v0 i   mov     eax,[00656634]            ; '\\.\SICE',0' ~7 N  G3 y* y
   push    eax
5 Q* x/ H6 g' e" G& F" F   call    KERNEL32!_lopen* W9 ?! A. C' H
   inc     eax( ^# N' ?! g$ F. Y# v% |4 v
   jnz     00650589                  ; detected3 T6 b* C7 d& _6 n0 J2 {/ V# p" g
   push    00                        ; OF_READ
! n) h& _8 l- r+ x7 ]+ @   mov     eax,[00656638]            ; '\\.\SICE'
! U4 {3 i2 ]& G" E   push    eax5 m( D- C( f0 ~- `7 |# E7 A1 e
   call    KERNEL32!_lopen) N9 p2 i& D. {  m
   inc     eax
' F; Y) w, }, j7 z( G   jz      006505ae                  ; not detected
9 r4 `' \% r$ V: }1 h
0 b% |+ G# F4 d5 ^7 Y7 E! \1 X/ O' b7 {
__________________________________________________________________________
5 ^! ?9 @  k. @! F2 t1 f" {' M; S2 r$ Z1 h- U
Method 12- Y. R6 ]1 ^! x2 A5 G( \
=========
* B; `' S1 A  ]7 s
1 O: `0 r! O7 d4 g8 h! q0 _1 v1 V/ \This trick is similar to int41h/4fh Debugger installation check (code 05- a) t& ^, G: p( H' K# W" `. W
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( t4 x; U. M7 l7 t- m$ F" E! xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) y# n0 ]: j7 o6 T0 {+ N7 S2 G1 [9 e3 A' x1 d" z& x7 }1 }6 x
   push  0000004fh         ; function 4fh3 c6 J# ]: x# ?) [- l$ u
   push  002a002ah         ; high word specifies which VxD (VWIN32)
, P) Y3 r% G# B& ~  u" i! r: g7 ~/ C                           ; low word specifies which service
1 I% F) u) j6 G" y9 g2 B                             (VWIN32_Int41Dispatch)$ o0 X! G0 t6 E- S" V( A
   call  Kernel32!ORD_001  ; VxdCall/ l2 k, T" c5 Y& U7 M7 |
   cmp   ax, 0f386h        ; magic number returned by system debuggers% }8 t) [+ j7 f+ |/ X! w
   jz    SoftICE_detected
7 ]' s/ V/ M) }& `
/ C: d, K$ V/ H: E2 d- [Here again, several ways to detect it:3 Y1 S2 {) `. R" x+ ?

6 k; f3 H$ b% g% x' z    BPINT 41 if ax==4f
/ Q9 W7 e9 b, a1 x: D3 N9 i: j6 l' u2 z( Y
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 O: O, s6 S' z5 Y2 x% t* [" k" N4 z
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; r$ u' u5 T( r9 t% d; `
; s/ _* |0 b7 R4 r( z, n- U    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
6 O( L3 z9 s! R+ a" r$ s9 \% v+ E
4 C4 H" z+ L+ v9 I0 b__________________________________________________________________________
+ C0 ]. `/ F+ V& d+ U5 d- T: E. Y9 u3 Q( ]' i) l8 n
Method 13. X6 W4 _+ d2 n4 t% q- Q% Y
=========1 S5 {9 P0 |) ?5 S+ k+ W; \# K
$ y9 d8 {' a6 S' @7 `, [
Not a real method of detection, but a good way to know if SoftICE is; @, _, e3 o* R
installed on a computer and to locate its installation directory.4 V: Z( P. `% H( n; m
It is used by few softs which access the following registry keys (usually #2) :! c/ _+ d8 _8 K  [8 p2 s

  H  t$ l4 u+ l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 i* F0 F1 o: w4 j1 A# H3 ^
\Uninstall\SoftICE
$ s/ S9 O. w2 ]% |+ o$ K-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( X6 q0 h/ Z; O* |1 B( M4 N
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 e2 g1 J4 _) }' U  v9 [8 l6 J
\App Paths\Loader32.Exe
2 p4 H4 _2 F6 z  w/ u# l
* x( S8 Q: I0 B# t/ j. s1 v" Y2 P9 T6 J  g1 P( M" \) q1 K7 E' m$ q
Note that some nasty apps could then erase all files from SoftICE directory- S1 `  A/ U2 M% Q% @
(I faced that once :-(" H4 X+ i5 ~8 f& E
* L- _$ E! N: o- Z& {/ n3 f# X/ t
Useful breakpoint to detect it:
7 |+ d' T- a4 \& x% ]( m( @0 A8 k( P: e% _. Q+ S2 \3 d' R0 p) ]7 G+ _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* [) k- C3 }" }  K: b$ B/ V  N# X( J1 E. I! T, m
__________________________________________________________________________
: g5 ?1 V9 U4 o( i: [5 p( `( o9 e& z4 Q/ e# ?
/ ~2 ?1 n- F- P9 R6 n
Method 14
& r  t) d$ c/ L  t3 C=========
! p- O; p# T& X" \4 q0 y9 m% z2 A7 D' {3 O& X/ y7 \) g; \) g$ J
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* S2 p- j2 l4 f0 I7 f
is to determines whether a debugger is running on your system (ring0 only).
5 G5 c7 K% [: B" K) M! n! I  U# P/ f& M( `& o0 k( p& \
   VMMCall Test_Debug_Installed% H) y# b% Z- r8 U' p
   je      not_installed
- i' U8 g' s2 y+ J+ T# u" B# q4 Q% v0 m, u1 O
This service just checks a flag.
9 w- o* c' C# s0 P. @1 f) b* F0 ?</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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