About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 C, S8 l1 z  Y* v
<TBODY>2 _1 \8 R3 R; P) W2 o2 ~) B
<TR>
6 d) R) W( z$ o* c- F9 Z( X+ j<TD><PRE>Method 01
  [% I* x" A5 X" r9 q* T$ u=========
' D: U% O3 U1 q' g7 Z0 c
9 D1 K, P5 p$ P3 L9 d+ Y3 u$ hThis method of detection of SoftICE (as well as the following one) is. D( m& A# q4 G7 k% f" f
used by the majority of packers/encryptors found on Internet.( V4 q! T$ S/ M; p; \
It seeks the signature of BoundsChecker in SoftICE: J2 g% N% X% R- D
" \' d6 G+ \$ e7 @1 W6 U
    mov     ebp, 04243484Bh        ; 'BCHK'9 Q7 C8 w4 r0 K
    mov     ax, 04h& c' t! p% r6 b+ h) z- t9 t7 s& N4 E
    int     3       ' I6 `8 q0 c% b( O7 a2 A
    cmp     al,4
' x$ ]7 ]0 Q6 @: h9 l    jnz     SoftICE_Detected( S9 I; H# u8 N7 W
* M3 m5 H- s( }6 Z% L
___________________________________________________________________________. Y/ z$ R; `8 L# Z# |7 z8 o2 ?4 r
5 f5 ]  z2 j# r& I. s7 Q/ W, P" }
Method 02  E& V# J8 a6 C9 x
=========
: {- [7 D' V% L2 W: |0 ?% c' z1 x
! \$ I- ]  b, [; MStill a method very much used (perhaps the most frequent one).  It is used( ^2 i9 v7 |$ @$ \; m5 ~# F
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 P' p6 I9 E4 ], c% ?
or execute SoftICE commands...
! S, s( O* M6 a9 hIt is also used to crash SoftICE and to force it to execute any commands& \3 }, |# ~6 H- J0 F4 M7 _# S
(HBOOT...) :-((  5 L' j. C2 O) E6 U, }

9 o0 u) s# A1 D5 t5 MHere is a quick description:: v8 u# w, b8 q4 }: u" s* l3 D
-AX = 0910h   (Display string in SIce windows)0 V4 h* c+ S5 f9 `
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 C0 D% ~8 W  p4 D5 `-AX = 0912h   (Get breakpoint infos)
* P; C4 M$ o% N% G+ V8 _-AX = 0913h   (Set Sice breakpoints)
" R8 }9 W+ R- t# I: n& r-AX = 0914h   (Remove SIce breakoints)0 P% B9 {5 M8 J0 Y3 S7 [0 y" z

% J2 _5 i4 D( ^% S/ L4 K% v, n! GEach time you'll meet this trick, you'll see:
0 ^3 R" u: z' p$ l-SI = 4647h! h1 G/ W9 F$ _0 ~
-DI = 4A4Dh
- u4 N2 Y0 I' N. v5 uWhich are the 'magic values' used by SoftIce.; T  J& b4 Q' D# F
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) Z' J: c" S7 r: I  N  `4 b
2 Q' @& ^1 Q. s1 _$ R+ mHere is one example from the file "Haspinst.exe" which is the dongle HASP- V% R- q! o% i
Envelope utility use to protect DOS applications:
/ e; B+ a3 C2 s3 ?# S
, d% i; }; u) v+ P0 L6 Y$ p
- b& Q; w# k! K6 t" S6 I4C19:0095   MOV    AX,0911  ; execute command.; z/ e& n  d8 \1 Z, x) Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ _; K3 e$ \; W2 _
4C19:009A   MOV    SI,4647  ; 1st magic value.
2 l0 F$ @2 e) x. c. g9 G4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# A5 {9 v, h8 P' Q2 V1 t; ~/ d0 [4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, B! @  C' ~3 C% S" D# f: T8 J4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
. u  w' I) ~% p8 J4C19:00A4   INC    CX
0 N; {9 ~* d3 h, x' }4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" [# h) W' ~- q& `) b: [
4C19:00A8   JB     0095     ; 6 different commands.9 a6 A# I$ [0 C+ I& A4 \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' d( B4 H' V5 t2 [& r) D
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)+ }. L( F; |' A+ h3 X- O2 p

  X! i+ U; }3 x  }The program will execute 6 different SIce commands located at ds:dx, which
* I& I5 H' w! W8 }9 B+ _are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  T7 f& G" t0 h3 S  E) {' N% n
& R/ _  G: E* ]5 M2 i( F7 s) A0 }! k* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 B8 A* O' M( X___________________________________________________________________________
2 x2 t  H0 r* T- t
  y. K  A3 [. ^; j# x" u: [4 l# {3 \/ J. ?% h
Method 03
: Q2 I  A4 s+ a& e0 Z=========+ t9 u' o" C% l% p/ t
4 q* {: o5 \% h
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' \  B8 w2 k/ F(API Get entry point)
. j9 C; l; G& P) }3 \' w. L        
, T. c/ Y0 |/ F% r$ g( |% Y2 Z) ^
    xor     di,di, |+ a+ ?- O4 Y- r4 s
    mov     es,di
+ V$ h0 Q1 O! b  K2 k7 E7 o    mov     ax, 1684h      
7 R# s8 m" i5 Q7 m# n    mov     bx, 0202h       ; VxD ID of winice
& a! E' A1 w  n$ N1 @- K) I    int     2Fh/ v- d6 }7 y. }- f: h9 J1 w  W; o4 [' k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! c, {1 b" u) B    add     ax, di
- s! I5 D- D, i( W    test    ax,ax& D. ^6 o0 n, W7 I% _  M- h( n
    jnz     SoftICE_Detected7 F) o) V3 c: K( F3 R( z
8 [/ }, z9 F% `3 S
___________________________________________________________________________
$ A# ^/ r- r* `1 u& R$ N
/ Z; p/ ^& N8 \% h+ I% VMethod 04$ m' A  m# g- G8 p, x
=========
( @0 E2 ^8 \( p/ Y! i: P  h6 S0 ~1 ?( z8 l$ ~% v, x% W  N
Method identical to the preceding one except that it seeks the ID of SoftICE. a* a  g# f3 C' o# ^
GFX VxD./ Y! w) L+ X: E( j0 a$ D8 a

) u0 H2 g( K- B* R2 S* x  F3 A    xor     di,di
$ x0 R& b. t8 _$ D9 _* ~    mov     es,di
9 g; Y- I- H( _& J9 Z6 R6 m! X    mov     ax, 1684h      
# S) v; k; C! |9 f6 C    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 W: p) a$ T, y1 ~7 {6 V2 M8 p    int     2fh( B/ @! c9 j+ Q& W8 P3 |2 E* T3 Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" b; t1 K( e: Z
    add     ax, di
) C! ~( U5 g8 c; ?/ {5 Y; K    test    ax,ax
. @" ^- C! X. E4 V8 ?$ r! h    jnz     SoftICE_Detected% @( u' ]2 A! a% B7 y  ?# C6 k3 [. Q

2 X. s+ {% [6 C* J$ D# Y__________________________________________________________________________
) r2 V# n$ o$ _! a& |! ]1 |1 _6 d9 t0 \7 J( Y8 y
; d  W9 F+ u, Y/ Z
Method 05
3 L# b% I  G: Y8 F6 h! O=========5 d6 I( c$ g: h( J$ \7 t0 Y% z! v
; f6 u+ }& t$ @# X2 `: a. N
Method seeking the 'magic number' 0F386h returned (in ax) by all system4 U  y% c$ z& Z$ X2 l4 k
debugger. It calls the int 41h, function 4Fh.
/ T' q3 S6 `. w- N% QThere are several alternatives.  & I9 S8 Q( L1 `8 L

5 e' y/ T. W( ~4 {The following one is the simplest:
! Y3 \7 p/ z/ O5 |/ Y; ]' r$ h& ?, o1 Q
    mov     ax,4fh! {- x3 d" }5 @% d! N+ h
    int     41h
: u% F' a# D8 N    cmp     ax, 0F386+ p0 t1 T; b1 Z: D
    jz      SoftICE_detected. ~/ a; W) b9 ]! p+ ^* g
$ c1 R2 Q$ a" s; o. r8 B
% p$ |. s3 b, C9 H2 f  Y, Y, `0 L) ]8 L
Next method as well as the following one are 2 examples from Stone's
% m" r/ ?7 n9 b6 R8 T"stn-wid.zip" (www.cracking.net):7 R. w- V3 a) y$ L7 A9 d
' I- M0 Z1 A/ S) r* P
    mov     bx, cs
% o) S6 q/ \: h5 K3 J; `: i    lea     dx, int41handler2
  u! J) b' S. N, q3 m0 Z    xchg    dx, es:[41h*4]
" n6 h# V  w4 _    xchg    bx, es:[41h*4+2]( U6 E4 P9 z% M/ e6 O
    mov     ax,4fh
8 x8 y/ h/ x& `5 H( v8 ~; p    int     41h: X( T& W; i7 [4 U  T: g* W
    xchg    dx, es:[41h*4]
& B+ |: C# j+ A1 C    xchg    bx, es:[41h*4+2]% s+ C+ G  Y7 ?6 k# v
    cmp     ax, 0f386h
4 y0 |# W4 Q" i$ L; G! `    jz      SoftICE_detected8 X' K; x# k( c6 ?' f
/ l- }( [- s+ n, Z0 S0 I4 S
int41handler2 PROC
1 a) x. x) H* y" t' w+ ?" E    iret0 C+ _5 }/ U4 K# a
int41handler2 ENDP
+ _: ^- F& Y+ V1 A$ V0 |# t$ ]/ P

# e* W8 R9 |8 ?. z1 X_________________________________________________________________________9 f2 |. ]$ j/ s7 e$ q

6 k% v# R6 [3 H! U. N
* E) X  G$ K4 bMethod 06, e* ^8 T' M/ e7 k5 V  T
=========
: @5 ]9 Z) G' h! o% f4 N8 k2 s% ^9 z

% K$ A, x0 W: V' E. M% y2nd method similar to the preceding one but more difficult to detect:5 A" d2 J: \; ~: q+ h  ]2 E
' |- i2 I9 f6 X4 H" U5 k. p
9 ]" c" ^7 I5 h6 l$ R
int41handler PROC
% p) N7 E$ H6 t; L& _8 G- Q    mov     cl,al! L9 d) K- E8 h  R, r0 \$ I" ]
    iret) E" n7 b7 X2 n; x) J9 D
int41handler ENDP
* ~  m- M4 s# R
3 D) }1 b  Y3 j9 f9 ^4 q+ {8 M9 h* L2 r& g1 w9 S& b3 V3 ~
    xor     ax,ax
7 Y% Y3 X, m2 J* K- [    mov     es,ax
+ W& a' {3 d7 }    mov     bx, cs0 u& e4 N8 o1 K, ?; F7 G4 @
    lea     dx, int41handler9 o) R. n( u0 x) o! Q6 E2 W' c  g
    xchg    dx, es:[41h*4]
+ v! ]" `' L+ Q% e    xchg    bx, es:[41h*4+2]6 ~9 z0 D' K* t) y+ ~% j/ b* d1 |5 k
    in      al, 40h
4 C, `: o: s! Q    xor     cx,cx
! m6 V0 y8 V, l! S. o    int     41h
+ T6 Z- [  Q8 |. M: C6 h+ L( b    xchg    dx, es:[41h*4]$ m, ~' Q( ~, k- m) O
    xchg    bx, es:[41h*4+2]( j( n0 y% w: C
    cmp     cl,al
0 `1 M6 L8 b/ Y, @    jnz     SoftICE_detected( `* p* f8 k- a

5 I; p* Q! i  m_________________________________________________________________________7 K6 Y" l, @; U& k9 g

& c6 M9 R- H5 [) [% H( p9 `Method 07$ O  n4 J. c; L! P# y* W
=========* D5 G9 H! O7 F* p. ^

* N2 P' c8 q: v9 m$ aMethod of detection of the WinICE handler in the int68h (V86)
/ m& O5 P: S. w' [, e1 L0 [8 _/ H0 N6 \: s6 s; \
    mov     ah,43h- J- c2 T- h! O* M
    int     68h8 C5 S9 t9 f1 j: E
    cmp     ax,0F386h
  s# p' y# X+ f    jz      SoftICE_Detected
- c- P% n$ v8 w4 w6 T
. H, _1 {9 o( M+ r* Y4 A- d8 a/ x2 f3 f6 q4 _  D4 z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- S* N  q2 e; f1 C
   app like this:6 ?8 g" Z+ a5 A
9 D6 x$ s) U( {) z8 f
   BPX exec_int if ax==68
0 d& k' m( J1 u. P. h! K$ [) n   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 p8 [6 X+ i4 }" N' V! U) B0 F7 d   located at [ebp+48h] for 32Bit apps)
; x. X3 \1 t9 f8 I5 B__________________________________________________________________________' z9 x) j3 `6 Q. u% q  u9 X! k* ~

# [6 P9 Z, B* ?6 _1 s$ J' k5 _6 N4 q: O  a8 v, m+ c% N/ n/ {
Method 08
" u: q0 I* L# G  g& S, X6 z/ P8 P=========
# N' @7 j7 C7 ^* k+ A
+ e: [% E2 b) e& ~It is not a method of detection of SoftICE but a possibility to crash the0 }- A& G! m% b
system by intercepting int 01h and int 03h and redirecting them to another
9 w2 F/ E' @8 ]) broutine.: T, J3 s+ w: ], F0 m) f0 c: f  C2 h. W
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points2 M. S) `1 [* Y  p6 i/ \
to the new routine to execute (hangs computer...)
" o6 c' h1 ]. {. T1 A
5 Q3 `& \/ G! O6 C6 l& g" U- d    mov     ah, 25h, i* d& f! F' e5 I" P& _4 p
    mov     al, Int_Number (01h or 03h)
# F, p1 U! I* Z3 A    mov     dx, offset New_Int_Routine: w' A3 F& @  j3 C$ s
    int     21h
6 \7 d, ?8 Z9 t# i$ @" b, b( Z; I! v
__________________________________________________________________________
! e  z$ N: I/ \
& P  ]4 A; R3 V# TMethod 09# Y. T; w, D, {0 x2 S: |6 z. e
=========
: f- @" I4 v/ d- r+ m3 _& |$ v2 _4 M% i8 {6 ^! d- n* q/ ?
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only/ O- y! f1 h; f/ {
performed in ring0 (VxD or a ring3 app using the VxdCall).
# t4 Y0 x  |0 D* F  SThe Get_DDB service is used to determine whether or not a VxD is installed2 z$ t6 T& S0 l) |8 W( r# e4 b
for the specified device and returns a Device Description Block (in ecx) for
# ~& _9 F9 _' }4 G: Fthat device if it is installed.
( R% _" r; \3 r# R$ C) ?( k8 S% q( T" W* j
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; D; c, Z! ~% M2 @4 {! @2 ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
  ^: r& P8 Z8 o+ J% r   VMMCall Get_DDB& Z4 |& D% k$ ^
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed- L9 W( ]4 z1 z, o/ c1 I
6 g! V0 E; r# X
Note as well that you can easily detect this method with SoftICE:) |) ?  ?( x- [8 T9 U1 O1 U9 i
   bpx Get_DDB if ax==0202 || ax==7a5fh
" t+ u8 S* F! e' K) a! I
  {7 f: R- q/ l8 y" z5 f. @$ y__________________________________________________________________________! c  }' l1 l2 P
2 X# N0 I0 i$ s4 ^8 W1 B
Method 10
% \7 T0 D9 e4 e=========
  z# W6 a/ U& t8 g# @8 v1 y$ q3 @8 N5 r& L, N) s2 S& N
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 W8 U3 A4 I; @, Z  SoftICE while the option is enable!!5 V1 o+ f3 j( U& H

1 q9 ?1 b' }3 @( kThis trick is very efficient:
4 r' `% M; y+ a- q/ zby checking the Debug Registers, you can detect if SoftICE is loaded
) o3 T3 r" P% u& B( V8 p9 q9 C# Q% L(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if  G/ W2 J8 N) J4 i" f' q2 P: L
there are some memory breakpoints set (dr0 to dr3) simply by reading their
; M' l6 ^4 N7 u* ?7 Y) Cvalue (in ring0 only). Values can be manipulated and or changed as well
- R$ J9 c1 [! s(clearing BPMs for instance)5 ^& X5 f' p5 H1 M
+ c0 F' `" t( V* c& V& f
__________________________________________________________________________( c& n3 j+ J5 B- V

7 m$ ]+ T2 m" U: o2 T" J' n$ DMethod 119 I# ~8 D+ J6 d9 u* [3 U, J
=========; i3 u' G* k3 v3 ~- f

( y+ x; J& `( f2 H8 F2 z! L1 xThis method is most known as 'MeltICE' because it has been freely distributed! v* H, l+ f- L: \! c( C. m2 g- B; O
via www.winfiles.com. However it was first used by NuMega people to allow$ L* h. |* }& a# S3 l1 @
Symbol Loader to check if SoftICE was active or not (the code is located6 j1 |' @2 G4 K
inside nmtrans.dll).
$ [$ x9 i% O' Q6 R3 c" P3 {- z, T: v3 m- Q- h' T
The way it works is very simple:. {. ]. D; J' _. q& y2 R
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 y7 g) u6 f) N2 o: XWinNT) with the CreateFileA API.
1 Q2 d4 ?, E2 F4 V* @* G+ L& c# D5 J/ J
Here is a sample (checking for 'SICE'):$ X+ `& m0 b- ]* y: H( e
5 x2 ]% N: b' y  {' L2 D9 W. P1 @/ t
BOOL IsSoftIce95Loaded()
& [& v# N! b1 P{
1 X) G' E( s7 p$ u   HANDLE hFile;  
4 ]& n6 W! h* J1 f6 l- ?* s2 n- l   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
8 D% J6 ^4 _( M1 X- d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
2 e* M& B+ [" A% ?7 G3 Y" P                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 Q8 _1 h# [$ w" \: |   if( hFile != INVALID_HANDLE_VALUE )/ \$ `; c; [' j. O/ G
   {6 a' I( \) `$ {/ s! B" d
      CloseHandle(hFile);1 L9 R6 E7 `5 k2 J3 ^# a  o
      return TRUE;
6 N+ f5 f; D: A  u: n/ T7 R+ _   }
1 N1 C7 f  O4 R* a   return FALSE;
) W* j# J/ J. ^% Y! `; t! R( Y}- e/ m, d7 v0 M- g8 i
1 G$ P; W$ O# H! H
Although this trick calls the CreateFileA function, don't even expect to be7 _2 {2 a/ I9 Z6 v8 i6 o" k
able to intercept it by installing a IFS hook: it will not work, no way!9 \% J+ ]4 ?+ _; k+ S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F' ~: B. k( q1 o- D; s3 ]% [; \3 Q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 T, N# {0 u; _( ]5 Q
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 @/ t2 l! l0 q! u& Y6 |
field.
: ~* O( r# w; f. ]" U3 zIn fact, its purpose is not to load/unload VxDs but only to send a / J! o  |) q2 K, ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE). w+ v# W  {% e% F
to the VxD Control_Dispatch proc (how the hell a shareware soft could try% ?6 o  C; n/ \; K8 e
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& U& |% o: j& O, |, g1 }If the VxD is loaded, it will always clear eax and the Carry flag to allow% U$ L8 i# [* s
its handle to be opened and then, will be detected.
- _# r! k$ Z" v# D  V* LYou can check that simply by hooking Winice.exe control proc entry point* v6 ?2 m2 |6 {& |
while running MeltICE.
5 X, a" F, _/ V" T6 L8 u+ X9 L% z* k! n  F

  y/ ^. X7 M3 r& e/ D( Q  00401067:  push      00402025    ; \\.\SICE! L" n, L5 y; I
  0040106C:  call      CreateFileA9 l' {. X3 B7 n, c: u
  00401071:  cmp       eax,-001
8 Q8 p- q6 c* u7 [! L/ V  00401074:  je        00401091
& I; h1 k5 Z$ M) j2 S$ I" H/ I# [& h% V2 m% z# D' u

8 s8 N9 j, f6 qThere could be hundreds of BPX you could use to detect this trick.
& r6 Q" G# g4 I0 s; T5 |-The most classical one is:+ S4 }( z5 G# y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ w/ D4 {5 g9 |) {; r
    *(esp-&gt;4+4)=='NTIC'2 [9 T( n1 q( V& \) y) \8 w4 v

, M; g6 b* c* N  w0 D-The most exotic ones (could be very slooooow :-(
; p( H* a, D$ \   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
5 M! a  c' f( D5 d     ;will break 3 times :-(* A' ], C& o% w/ L2 f

. \8 L6 r0 m6 ]( K) l-or (a bit) faster:
9 r) A8 S& `" B. d/ w, Z$ x   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# l) |  Y% x3 \; Z2 v0 {0 x
# O* @/ \1 A3 q( \, X( s
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  , o5 J2 g6 h) C
     ;will break 3 times :-(9 H% X# S: s- H8 f- G

# m) j9 _- q. ]) ?2 Y$ w-Much faster:/ j! m4 A. ~8 s5 g. B
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 e5 N) v$ i- e  N" e! S( Y/ g* J2 u: U6 W; o. E* U, b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 i, v5 C7 \1 d, ?) M4 C. Ffunction to do the same job:4 I) L/ y; q. d8 t
* p( g! g$ W% h; Y
   push    00                        ; OF_READ, Y# D% g; L0 P6 B  S; P6 q3 `/ R: g
   mov     eax,[00656634]            ; '\\.\SICE',0
9 V" H0 M: a5 a3 n; L   push    eax
. K" S6 B+ \& d0 S8 B% z   call    KERNEL32!_lopen2 s7 f0 ^9 @( d. B) R. X
   inc     eax
' n& L1 X- H2 H0 Z6 ^" m' s2 p  b   jnz     00650589                  ; detected5 |1 R; M( y& ?+ P" N
   push    00                        ; OF_READ+ w/ G$ r9 c. K4 f
   mov     eax,[00656638]            ; '\\.\SICE'
2 I# @4 P% I2 e1 x- a   push    eax, ~1 @: q: X7 d& Q, T
   call    KERNEL32!_lopen+ z1 |! N& {6 \- _
   inc     eax$ G, Y- E! n6 ~
   jz      006505ae                  ; not detected+ B. f2 t( `* q, X

/ u  f0 u9 }+ W  o* D$ e2 F' P3 ^- X, C; A- o
__________________________________________________________________________1 u2 V0 g* c: ?. {. M2 U
0 |6 C! ~7 C! u0 H
Method 12
9 j4 Z3 x) G: C  X2 p. n; f6 ?) s=========4 B& J# {- \# q# b& c
2 t, m; F9 U  F- i1 x% L
This trick is similar to int41h/4fh Debugger installation check (code 057 l; P7 ?1 P3 u* A% ?
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' e& S( T, Y  t2 g, kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  W& t9 h$ K. ^' |* a' _
! c' e6 W: t- A' m4 `. O   push  0000004fh         ; function 4fh8 K- u5 [; {  ?  |/ s' Q( n
   push  002a002ah         ; high word specifies which VxD (VWIN32)2 j* m% S7 U# J  h/ c/ p
                           ; low word specifies which service5 e$ H4 v7 T, L4 x
                             (VWIN32_Int41Dispatch)
, o! c; a1 V  U4 a, [: q* O   call  Kernel32!ORD_001  ; VxdCall
* j- q9 G) U& d4 f   cmp   ax, 0f386h        ; magic number returned by system debuggers
' f- I4 b) Q2 X1 R5 w   jz    SoftICE_detected4 T6 B8 X) o# t2 G! b+ O6 x
9 Y5 z0 G- e: a
Here again, several ways to detect it:, ^! Z& I+ w' @6 M+ x; H5 h
8 A9 F1 V1 Q# a
    BPINT 41 if ax==4f& \5 W% ]7 M- S. {

+ S" Z+ ^1 I; E! @6 [7 G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 K" i: E) c6 t" F

9 T3 ^$ P' |) m8 H    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 j+ D# j4 f) ~

/ U, Y0 U- r3 r( L    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
6 w& ^' O$ |, X) F8 e7 O/ D
& k0 h. a) w; S2 T__________________________________________________________________________
3 K" P" V. M, ?+ I8 P5 N% Z: R  w- V9 h7 O) {1 n
Method 135 f( p, z4 }. W. @' J
=========
+ J- i. ]6 q$ O$ b5 |; A0 k8 \& u3 I
) j  _8 V% U# i! XNot a real method of detection, but a good way to know if SoftICE is: i2 l  A. c# O: O5 F- Z9 Y" J3 |. H
installed on a computer and to locate its installation directory.7 k% R9 a) b# Y& b
It is used by few softs which access the following registry keys (usually #2) :  h- K* b/ {: T- W' S
, R" ^  I+ K1 p" l, W2 e* R: v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" j2 u* ?' ^0 _' [3 I
\Uninstall\SoftICE
6 l6 b: l0 W9 h$ w8 ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ |* ]8 w1 p6 B) O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- z" J" X* ]" d
\App Paths\Loader32.Exe0 B  f( f- l& D1 h
4 T1 \2 F+ r4 B3 n! q
1 P7 I4 U  T: A& a
Note that some nasty apps could then erase all files from SoftICE directory
4 ~9 x% U* E2 y5 r5 \(I faced that once :-(5 F- u0 ^3 h- [7 S% q6 l

( K, Y. {* j- a- ^$ y! n- m6 b) `, GUseful breakpoint to detect it:
; @4 [- d  k0 @, F% @6 M/ a9 R2 G3 {2 N# ^6 Q) Y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
& W. Z( n/ S1 g5 _2 ?& x3 h( r3 u
! i5 ^0 A. }2 _8 w. ___________________________________________________________________________
1 d' u4 M+ J" \% f. H+ x, p2 H# B& |# [& L" n
: I0 D: `" W. U
Method 14 - @$ u1 Y  F6 w# g" r3 A7 Q
=========
6 S( q6 J8 {' \+ X# i9 i# w. ^" A2 v
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 Z" \# N8 X# k  t$ i# E: ~5 N, G
is to determines whether a debugger is running on your system (ring0 only).
, U+ R+ O( X' f% r# K, P9 T
: @- m3 q, b: c1 z: A7 b2 E   VMMCall Test_Debug_Installed
7 h, w8 }+ w' P1 T% ]   je      not_installed7 H  v0 q* O1 N0 U) H9 R* V# j5 J2 T5 z
1 n- o; T' A3 a- a
This service just checks a flag.! o) i5 ^' e" ?+ J' L
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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