About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># H- e6 D4 I9 Y- i# J. S
<TBODY>6 G: ?2 U. r  Q$ ~# B/ D2 f
<TR>2 h! a1 f% G- e1 c' q
<TD><PRE>Method 01 8 C  K+ a1 d  |7 F. Z9 b
=========4 Z! L5 J4 h1 x0 w4 W0 {

7 R0 D2 [$ n! i! ]* NThis method of detection of SoftICE (as well as the following one) is
7 J+ ]4 Z& O8 I, \) m' t1 D% x3 u8 m3 eused by the majority of packers/encryptors found on Internet.3 K% I0 Y5 c' U) r* q
It seeks the signature of BoundsChecker in SoftICE
$ e) }3 Q; f+ J7 A
$ z! }9 c; F) C8 E    mov     ebp, 04243484Bh        ; 'BCHK'
$ X6 s# T7 [3 V& L; L# v    mov     ax, 04h, n% Z9 H" l" y% l+ K* Q% \  Y
    int     3       - F- o+ v6 f5 l$ h
    cmp     al,4# J( h. m1 l" g
    jnz     SoftICE_Detected
2 W/ C; ]9 c# C: |% D$ J7 K
. d: @- e1 n# Q___________________________________________________________________________4 p+ O& m( L7 {
% o8 B' _5 w5 i( U! k5 b
Method 02
' l8 H) N+ r+ ^9 V. g=========4 @1 ^- r: R' }* E* ]8 s

# C% k; r' O* T: h4 UStill a method very much used (perhaps the most frequent one).  It is used
4 O9 H/ d7 [" p" Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 X9 W! a4 A$ `4 y& Bor execute SoftICE commands...; v- z: b, l8 |0 I8 N( y
It is also used to crash SoftICE and to force it to execute any commands- a& y: ?4 ~. I) x% h. s
(HBOOT...) :-((  
8 S8 M* f+ B* }5 |7 \
. ]2 {/ W) ?- t+ r5 [Here is a quick description:
+ {# U9 Q2 Y0 b- D# H, s-AX = 0910h   (Display string in SIce windows)
1 u$ d" d4 _$ Q. ~. _-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& X; I& `+ M3 ?
-AX = 0912h   (Get breakpoint infos)
" {' K6 d# q& H; F" w-AX = 0913h   (Set Sice breakpoints): @3 p; c& l% q$ I
-AX = 0914h   (Remove SIce breakoints)
. ?8 N# |% W0 @* e6 J0 `. K
# r% G4 d1 B' F1 [9 ?  c3 Q4 NEach time you'll meet this trick, you'll see:$ W2 G0 ^+ H) r
-SI = 4647h" V, ]# Z7 v; C& \  F
-DI = 4A4Dh
+ t  w4 c3 W9 |( k  X/ Q- OWhich are the 'magic values' used by SoftIce.
( j4 S6 J  @9 J+ m" u7 |. R2 gFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 n3 f+ p4 O8 W

* E* @5 C+ e; n( o! }8 R, X( ^+ mHere is one example from the file "Haspinst.exe" which is the dongle HASP
* ]' b" C* ~' t4 AEnvelope utility use to protect DOS applications:
% H7 j# z( ?  ]+ g$ e* N7 g1 y- e% ~+ x; A! |

8 V  U2 L+ o2 m+ n  V; y/ j4C19:0095   MOV    AX,0911  ; execute command.4 ]0 w  t6 {3 }7 d: ^
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 ?5 v3 t: V/ F1 P4C19:009A   MOV    SI,4647  ; 1st magic value.
! F' x  u' s8 r" w4 y6 r2 c7 D4C19:009D   MOV    DI,4A4D  ; 2nd magic value., ^- r/ X+ O: z/ I9 X8 Y
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 C$ Z+ t5 d, M3 V# y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; v% i+ k$ [0 t+ D& t( U3 S6 a4C19:00A4   INC    CX# R: X& K  Q. w2 k! t8 s' i: s" i
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( [5 t( m  z6 K4C19:00A8   JB     0095     ; 6 different commands.
/ y; p# i% K6 R2 O& _4C19:00AA   JMP    0002     ; Bad_Guy jmp back.0 F8 t0 x" R6 U% F* S9 j2 i
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- d* f( a1 k. g+ B; p9 z$ o$ x

, T. z7 B0 E( D& |The program will execute 6 different SIce commands located at ds:dx, which% D5 {% B5 w4 u3 w9 l
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 n% H0 F3 k4 n: @' `% i+ J8 M3 f5 ?3 g- N; ~! f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.- X2 i& H! \- |# T
___________________________________________________________________________
" V6 A* ?* y1 E5 ^1 U7 t
, R  f8 D8 L1 o' @0 b+ _8 C# |& Z  O+ _, n$ K) T; H( l1 o
Method 03
9 o5 W! E! E8 [- K: w=========
1 U8 n1 T& ^# M4 A) c
1 R6 P% x0 G+ z' K1 l- v2 LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
5 w3 v: E5 s' E6 n(API Get entry point)
5 x8 i6 t1 ^) W- f4 W% a" O2 D        + l1 j3 R4 b6 A  P6 r: Z
! q) F5 R- [, a+ Q) g) V, T0 M
    xor     di,di' g' B* f; P, B3 E1 M
    mov     es,di
  H, w% p; o, s( K    mov     ax, 1684h       1 ?0 A  u3 [8 }  n( t; w
    mov     bx, 0202h       ; VxD ID of winice
  A: X, T; n, f' y% f0 D) F    int     2Fh" W9 h/ C4 v! j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' M. _+ z* Q' N) i+ @: f/ n    add     ax, di
* Z' m2 i6 i4 M- ?  y2 J6 u4 b    test    ax,ax
$ ]! l3 Y7 S4 a8 ]$ `  Y# R. ?    jnz     SoftICE_Detected2 O4 ?( _$ J: b/ M$ Y; C" d
2 d, M; P% s  b# N+ ?
___________________________________________________________________________/ S6 B2 ^, b& P% m( b$ x

" T, z3 Z8 x; h" G( c9 J0 n- qMethod 04  y$ E- H( o# Q& }7 M  d1 r& L
=========- A- V( {/ N+ {/ H7 J- `3 t7 B( t
2 y0 m5 L1 J( @1 y
Method identical to the preceding one except that it seeks the ID of SoftICE' n& t! [) O+ a* }/ f6 S5 B3 O
GFX VxD.) N3 E8 ]" _- j: j

: ^' j) E+ U" S; c# }    xor     di,di
9 `- D/ @' k- L4 c6 R! U1 n- N; z    mov     es,di6 X( I0 ~' x0 h/ r6 R% w
    mov     ax, 1684h      
0 \! L" [4 f: }) f+ x) \6 X* ^    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" M1 A+ {, F$ m$ _9 r3 }    int     2fh! U* g" y) Q' {$ X4 i6 a
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 d, ~3 [7 J( Q
    add     ax, di
  G2 ]1 ]' N2 X+ f- V5 J& N    test    ax,ax4 S% ]" C3 A/ t9 ^/ l5 K
    jnz     SoftICE_Detected2 f% n0 r# F  n! g( O1 ~
/ L, F* @! }) N9 v4 [9 n) H. I! {# P
__________________________________________________________________________
8 s; i4 L$ m6 d4 _  ]) M8 k. s9 O: f, g. \3 E  |9 J

6 T) Q1 S% U  @) ~& N6 T1 vMethod 05
% R4 i+ h. a! Y8 K3 W- ]=========4 ~& `- J, ]9 i5 h2 g- \

5 h6 s1 T2 T( d4 RMethod seeking the 'magic number' 0F386h returned (in ax) by all system; S# J+ i" P( _( f8 q
debugger. It calls the int 41h, function 4Fh., q1 s: {% ?' G9 }! N$ f" J3 \
There are several alternatives.  ; Z! `8 G; \1 U2 {/ @- I; C
" s8 E8 ~4 `; e" q& a
The following one is the simplest:
- z& t8 O# a1 P+ A" l; y2 ~5 _, h: Z3 \/ J; o+ \8 N8 c6 v  d: D5 K& w: _
    mov     ax,4fh9 A+ U; i8 [! Y) h1 }1 ?8 B7 Q3 x
    int     41h
% x' Z- p. c. f  F0 K    cmp     ax, 0F386/ K% \  x2 u3 A; H, g/ b
    jz      SoftICE_detected
% D9 r) D1 K9 T& o" l$ A+ `
# K! G1 Y+ e3 e6 m" p$ {
( S  O! t8 w6 T( ]2 n: Q- o/ INext method as well as the following one are 2 examples from Stone's / g' u8 j) C* Q7 f8 D6 y
"stn-wid.zip" (www.cracking.net):
- ]& X+ [+ H/ m: r7 G7 l3 K7 ?! o8 U7 Q
    mov     bx, cs4 c# J' q7 f' ]6 Y: ?
    lea     dx, int41handler2
1 {  x/ a( V4 o& ~# S/ ^% P' B5 r8 f# X    xchg    dx, es:[41h*4]
4 k$ B4 k. b& |1 d" V. D2 A    xchg    bx, es:[41h*4+2]* J1 ^% p$ I2 Q1 K8 T: S
    mov     ax,4fh3 G; p. F* c; h* p- y% C
    int     41h
7 \% Z3 G) F4 C# A5 n0 }& o    xchg    dx, es:[41h*4]6 t5 ]: r) [  X8 L$ u( p
    xchg    bx, es:[41h*4+2]6 Q# j& y. k3 t& E9 E
    cmp     ax, 0f386h
' R5 Q+ o9 {' ~# C* L. H    jz      SoftICE_detected/ S( ]2 o8 i7 s; ~6 V% k) x( ]

1 @( Y5 c. S; @7 }/ n" Z8 iint41handler2 PROC
7 w4 o5 O3 l, H5 q& p  \) M    iret, a* Y6 U+ J* H- {7 ~
int41handler2 ENDP
3 A2 Y; c! Z# @' {' c/ ]; g6 {# d% U( M

  m+ R. X5 t! Y+ c+ r_________________________________________________________________________6 e# C* [. t4 g, l" I4 v! u" A

8 ?. ?  K4 r! Y0 Z' g
' v$ `% P6 ^4 S9 p2 GMethod 06% p5 w* X  h1 _- }  n5 G; O, I
=========! q+ W* D5 M9 s; u, Q! t" w
1 y  f( P: `% ?0 Z) g

2 o  @3 Z: \  b3 C+ }# q2nd method similar to the preceding one but more difficult to detect:' [8 W& s; H) [& E* [' Q

3 k$ V4 ~) `  @
7 {8 {- q' K3 U% Y6 s$ V7 ?6 l: w/ wint41handler PROC' X4 [; B% n) Q6 [& G: Y
    mov     cl,al
2 m4 \3 O" T7 g* f& e" Q4 L: q    iret
# [" P1 {& e0 b# Q1 m( [' U' f1 {int41handler ENDP: r5 i  `( a2 F/ {

9 V" W" ]" O& W
& v6 \( ?/ t/ ^3 P: |; g$ H    xor     ax,ax. g# |4 ?) U& J- M% E: y
    mov     es,ax
& S5 i  I7 t( Z$ A1 u    mov     bx, cs
; A: [  l: u, O5 g    lea     dx, int41handler- b2 ?; c5 X% R4 E4 t. |3 Z
    xchg    dx, es:[41h*4]
3 z* H+ j8 B8 w$ R7 O    xchg    bx, es:[41h*4+2]
6 _3 b9 a% b+ ^( Z8 C    in      al, 40h% P5 q; B0 C% |* ]# M/ X; t1 Y
    xor     cx,cx/ M- Q, E8 A! S& ^5 t2 [
    int     41h9 I" m' c! u/ Q4 ^# T+ y. `* ~
    xchg    dx, es:[41h*4]" j, l* O  u$ `7 `9 u; A: R
    xchg    bx, es:[41h*4+2]. i  Z, D  [4 q5 I
    cmp     cl,al# z$ O( j% ?; F9 P4 h  D, Q
    jnz     SoftICE_detected/ G2 C3 g0 J# h

4 K; U3 v( \3 q8 `_________________________________________________________________________; ?( q( T. R0 y7 o0 K

2 L2 \5 \( I& z9 \  d: _% p& ^Method 07/ F* O& y! O. E: J
=========
8 U, C+ C1 d6 E4 u3 v. Y' [5 g5 A
Method of detection of the WinICE handler in the int68h (V86)
$ T, k$ I7 x3 B3 ~
1 o; ]5 v( v& o  A5 A$ w0 A7 `2 Q    mov     ah,43h2 B' L% r4 s& J& R+ r/ l
    int     68h5 J; O4 a( ^# M( _# o
    cmp     ax,0F386h+ E$ w, b4 U0 `" T7 x
    jz      SoftICE_Detected
6 _) A1 F9 i# j. h
" X" L+ d1 a0 I+ p4 Q
2 G8 S; \& d7 [- V% m- _+ \* j=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; m$ C4 E! ]/ d2 R* V$ P   app like this:
; X$ M7 D7 C5 b/ ~# F7 X- v
2 y- T( X6 a! z! H% y+ I" K+ r. u5 p" g7 f   BPX exec_int if ax==683 N( N! {+ K$ T. Y1 j
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ {# ]5 ]1 F7 W' V' T4 [   located at [ebp+48h] for 32Bit apps)' P% a( a  O! }8 a- @, ?7 Q
__________________________________________________________________________
/ u. f5 s* {0 [$ U. g: y. u$ n* |: y& T: L
, {' q) X' a  ^7 Q$ Z/ G) x; s9 W; @, t
Method 08
' L7 z& g, J, x5 E) _, x=========
" P3 q! a2 y& A2 c
  r% S5 I4 ?; D# `+ hIt is not a method of detection of SoftICE but a possibility to crash the
! i2 z& {5 u0 O; j( zsystem by intercepting int 01h and int 03h and redirecting them to another% ~4 z8 b6 q9 O* q# M" `2 z
routine.( _; O( \' u4 L4 U* P
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
7 m4 a  @% z0 sto the new routine to execute (hangs computer...)$ m% |, g# H  C! T

+ u. z( X& ?& `. J6 N    mov     ah, 25h
  z& t8 A& H  ]" U    mov     al, Int_Number (01h or 03h)
: K, e7 X/ f6 w, Y    mov     dx, offset New_Int_Routine9 t3 c! F1 @2 b+ w( E* W* r5 ^
    int     21h
% u( c! A# f1 Y. {, G, X# j5 a8 {8 z+ N
__________________________________________________________________________
2 O5 u+ ^( _- q* Q; f' m( u3 I7 r& h1 G* Y! V8 G
Method 093 ~! L  @) @! A+ _" |/ p
=========
, {- y, s6 Z; p, j; U) }* H$ [2 }4 C4 z% ?5 ?5 D! u
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. y7 J/ @8 r/ S& Jperformed in ring0 (VxD or a ring3 app using the VxdCall).
# g4 B# E9 L, ~  H0 xThe Get_DDB service is used to determine whether or not a VxD is installed: ^8 _+ @; [0 `2 i1 I9 ~! h4 p
for the specified device and returns a Device Description Block (in ecx) for+ M. l6 a% {8 [) q
that device if it is installed.
3 c. a. x0 q; P% U8 h
6 d+ s9 f" a" Q" a+ _* G+ p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 Y0 ]2 E3 |7 U$ Y% v/ Z! D9 x   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)- Y. h9 ]* ^% M3 v# e. i( l% b
   VMMCall Get_DDB; q6 ?. G+ y9 V8 `6 o8 y! P
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, o! [* b, b5 V3 D2 A% w6 Z: c- m" l( r+ a) Z
Note as well that you can easily detect this method with SoftICE:8 B" I, H$ `* |
   bpx Get_DDB if ax==0202 || ax==7a5fh
9 `" `) a7 Q$ j% X. C8 k! N
- k0 v+ ]6 S; u( y9 }0 R__________________________________________________________________________
' ?0 h5 b/ ]) k: {8 f7 o" l3 C& t) U+ ?! \& w6 P2 m2 [
Method 108 X- c- K( z5 Z0 a8 ^6 \3 b; Y
=========: J& C; r& a: B* ]
& E9 o! G! T$ h2 z" k3 S
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* q( [4 c; a' I8 z; a  M$ d! k' [2 E3 j  SoftICE while the option is enable!!
$ p  s% v9 P, U# O  Q5 |' d8 J; L" ~
' ~! o4 y& H8 E2 J0 kThis trick is very efficient:
) L% J* c" d( ~' Xby checking the Debug Registers, you can detect if SoftICE is loaded% a1 {; v3 A) A- ]9 {
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 h0 p3 j0 n! R
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 r* T2 E; @% M, x4 X  V" m/ }# _value (in ring0 only). Values can be manipulated and or changed as well7 {6 E8 O- p; }  L% {4 u- i% d
(clearing BPMs for instance)
7 d3 c& q9 G- T0 [
4 U3 U) i- ^( F8 O) q, e5 Z__________________________________________________________________________* E8 p$ c3 B. G+ r  {9 v; w

3 @3 E- F1 f" q! ]. Y% D, rMethod 11  T' a9 v* b7 A. B6 ^) F
=========9 `! ~) q  W. u% F

  U8 v* c6 z3 jThis method is most known as 'MeltICE' because it has been freely distributed
7 D, q  S+ U: F1 qvia www.winfiles.com. However it was first used by NuMega people to allow
4 H; d3 i5 S5 v; F9 P* WSymbol Loader to check if SoftICE was active or not (the code is located
0 Q0 z2 c" {& o/ x* c$ Y6 }5 sinside nmtrans.dll).1 q3 m0 z3 W( f1 F2 [
3 w9 m0 M5 B0 M/ O
The way it works is very simple:
- K1 J' n/ ]- t1 K5 ]It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% r2 ~" E* v( v/ O( V2 ?5 T
WinNT) with the CreateFileA API.
5 {7 W0 s2 D' I# S' f+ A2 q9 g& m: k% D# }" t6 H/ ?0 w, K6 P, z/ T
Here is a sample (checking for 'SICE'):
) G% D2 I  t4 f. n6 t" b9 C) l* ]9 n& F3 {+ ?7 `! d% Z" i0 H
BOOL IsSoftIce95Loaded()
, }$ ~% w+ K% X, n+ S( X' {{
- `* O/ ^1 N) k5 N9 c5 e   HANDLE hFile;  
6 Q1 G" ?6 L- F+ g, ~8 J( \* C   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ @9 z0 a. n7 Q8 L" J8 L  U) a9 \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. r: R! H$ M/ @! {9 Y0 \' |2 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);6 U: ^" ^5 Y' [- t7 `% |
   if( hFile != INVALID_HANDLE_VALUE )! C6 p  O5 _9 B6 I
   {
7 w* `1 z* F+ J3 _3 ?' U7 K/ }      CloseHandle(hFile);
- X2 S$ r& b8 {0 O* H, f( e1 h      return TRUE;2 y6 z) t9 d/ I7 T; |  z! O% B
   }: ]. K: G  l+ S/ J
   return FALSE;% |$ e' U2 j" a; {
}$ m: m; o: U# u$ [, b* o
+ Q( [$ u+ G6 v& [
Although this trick calls the CreateFileA function, don't even expect to be0 M; V8 E. `4 q
able to intercept it by installing a IFS hook: it will not work, no way!
) W/ P7 n/ c$ q) P! y4 oIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
" \( I0 S: t1 v, f& }- B" ?6 o' ~service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)- D) Q2 n8 C6 ]
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- O% i" C6 i: f% }% R( jfield.
# N1 ]( g2 z- X8 A+ L& LIn fact, its purpose is not to load/unload VxDs but only to send a
) Z6 X- f1 E* x/ F# SW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) G+ q2 q4 K5 T5 q$ H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; Q' E% G; N: a( gto load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 j2 K: C$ L- N% n7 x; }7 XIf the VxD is loaded, it will always clear eax and the Carry flag to allow
- z: t; d0 x5 \/ u6 Qits handle to be opened and then, will be detected.& w/ c2 `" v8 u7 t
You can check that simply by hooking Winice.exe control proc entry point
( O- i0 w! n6 }while running MeltICE.% G  J7 E, @4 P1 d- [1 I; T

. y! m2 Y; C: E
/ h* i  E7 F) b, C' q  00401067:  push      00402025    ; \\.\SICE
# Q( u! P9 s$ c" n5 q$ M' y/ p  0040106C:  call      CreateFileA
! [: n; n* e" j$ D* p) q  00401071:  cmp       eax,-0018 S- t) _  ^/ b& L( b
  00401074:  je        00401091
; y& W2 u  x7 P& v) v1 G. t3 f
. N$ p! \  \) c4 K- @
0 D8 w5 t1 a0 J+ f6 b0 a. IThere could be hundreds of BPX you could use to detect this trick.  y! ^+ b1 c$ g/ A6 p3 b( U/ e
-The most classical one is:
) L# y% p! o. a" Q. J# R! H( r  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. k) z  m" ~" B. ^$ X: A, j
    *(esp-&gt;4+4)=='NTIC'8 T% J* B7 |# u9 `
- m8 g9 ^, k& f( A, `9 r8 o/ l
-The most exotic ones (could be very slooooow :-(
4 t1 K8 i" w9 a* F& F, h   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 b1 C% [6 A2 q3 Q* Z
     ;will break 3 times :-(0 j& s; h/ ^1 q! k6 j4 d4 i

! [, }) _" B! U9 R/ M0 d-or (a bit) faster: ! N3 W$ u1 `; w2 }$ o
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
! k" }7 P' ]) W8 ]) F8 U4 i
) Z& d! ~- @$ s  T$ C$ G   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) c# Q9 n" a' H( \: l  e     ;will break 3 times :-(
; S5 I# n; }# K# R
8 `% E  W# G  A5 n4 r-Much faster:$ ]9 V8 k9 E3 X) A& H
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 L. E" ?- C$ z- i! D* o$ M/ @1 l1 I
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ y9 W$ U" W- n  M" C9 {0 H
function to do the same job:
, b& k. n5 o2 E$ d% T' n1 s) Z* L9 W% ]$ K
   push    00                        ; OF_READ
! w$ Q5 X( V! F# t8 \   mov     eax,[00656634]            ; '\\.\SICE',0
" S8 q& y1 u/ p" K# Z2 {   push    eax
4 H4 Q3 ?9 f6 s! S, E+ |! B; n. p' T   call    KERNEL32!_lopen
/ t$ @5 e8 C' D) M* A7 a& u   inc     eax
! `1 r2 q6 |  L0 x& ?8 m   jnz     00650589                  ; detected9 R$ O. U. I3 {/ \0 Y( t' k
   push    00                        ; OF_READ& Q  t1 w. U# K3 U9 j. i
   mov     eax,[00656638]            ; '\\.\SICE'0 ]: s8 g' l0 u" T
   push    eax
" L7 _2 ^! _9 |+ s; a   call    KERNEL32!_lopen
! J& A) b' i1 u% }# J   inc     eax0 B, c" h& [) Z- C; a- b
   jz      006505ae                  ; not detected
6 i2 F1 m# ?1 U/ Z+ t# u, {1 D! a4 _8 O  X5 C
! B. ~$ g9 J- m4 o, H7 w
__________________________________________________________________________2 g9 ]: j* }( I: u

9 r8 ]# H2 @! t- }$ p/ K0 n# r* b! p. AMethod 12  Y7 q% z8 s: V+ }* D9 B+ R
=========
& W$ L0 |) I. F0 d1 @. \+ E1 e" J9 B5 g# A- n8 p
This trick is similar to int41h/4fh Debugger installation check (code 05
4 j, d2 \6 E  O0 M/ i) X&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' n: X0 @+ z: D3 r. e, e% }as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 R6 [9 c% `% C3 g& C# n0 z5 I5 ]; N, i: q+ X
   push  0000004fh         ; function 4fh
  ~; z: S: j" R- `   push  002a002ah         ; high word specifies which VxD (VWIN32)
; z5 w$ h( ?: J5 w( |- s" F                           ; low word specifies which service; m' ]" |% t" j* {
                             (VWIN32_Int41Dispatch)
7 p+ A0 M; M) ?) `  [* k   call  Kernel32!ORD_001  ; VxdCall
. O; ^  F/ m+ M  }+ n' Q   cmp   ax, 0f386h        ; magic number returned by system debuggers
# x( s& w- P2 N7 n* [" k; v   jz    SoftICE_detected
4 N( c( `% r9 R9 N) ~/ j1 y+ }# @
. c% ~  [! h0 u. F& `5 GHere again, several ways to detect it:
2 y4 B" M; y* e6 v0 V9 X7 c4 H' ~1 }5 T) V0 a! p
    BPINT 41 if ax==4f
9 P' ]1 ~) t* Y' |3 m7 @% Q6 P3 Y0 b8 s( J/ e' p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 T% d$ a  w2 {( f+ R7 @. b( e
* J( C4 T5 V! r    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! C& K4 [. c3 ?6 Z2 w* m1 ^5 a2 g. [4 _( ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 e  D2 T/ G( l6 k4 K
9 [$ {1 V# z0 A) Z+ N$ v9 T
__________________________________________________________________________$ ~+ _9 t. I  O( ?8 U0 a

3 X2 F$ x1 B% U" ]Method 13
5 Y3 I6 Q# \0 X% F/ O=========6 c. E. \; U0 I. W1 g

% |0 I5 x! ^( d+ N: ~* f5 b. W# ?Not a real method of detection, but a good way to know if SoftICE is
  k9 y. s* a3 ~5 P2 winstalled on a computer and to locate its installation directory.
8 s3 p2 Z/ V$ M! l& B  KIt is used by few softs which access the following registry keys (usually #2) :5 f7 u  _! h4 B. a1 M

: @( E) ]5 P- P4 r-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' f$ {( d& p9 d# `+ {& m$ [( N6 }
\Uninstall\SoftICE
! v" F2 d% a9 \" p! Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  ~  J3 _& n9 d$ S8 d" O
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, D# u9 A' K7 s" z# _3 r0 |5 U- E# x
\App Paths\Loader32.Exe
& t* Y6 o. U1 @+ @0 s$ b/ I: |0 E& k1 i/ u
  M0 Y6 S& ^0 `+ G2 B" S
Note that some nasty apps could then erase all files from SoftICE directory3 m; {4 j8 q( N1 ?5 x; S
(I faced that once :-(: r; y/ u! c! H4 q& l0 r  K, _

( N7 u; A% K. `: q- u# A9 M6 ~Useful breakpoint to detect it:
% W/ f8 }# m1 U) |6 @& i9 }$ L6 x" Z# A- h7 ~
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! d# m1 W7 c# E2 l' z  W7 W4 I% q5 s! r) g" I4 ~8 \
__________________________________________________________________________
) X  H/ \* m, Y/ v- d
/ u6 r- l, r2 Q2 G6 P5 I8 S  ~" H
5 a: t4 E; S" {Method 14 7 Q" {/ c) L9 N& ]" ~/ s$ U
=========
1 v  g2 }( h; v; q6 ~& j( ?, K1 F3 }" R* d- K
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
0 M) }' o' N9 N& cis to determines whether a debugger is running on your system (ring0 only).
8 o. X9 A0 g+ M" [; |2 F: f% u* _9 T
   VMMCall Test_Debug_Installed
! l* E& _1 d2 y  M* Q' d8 b   je      not_installed8 T& `. c' ?5 p+ G: ^- V3 C  L

: K; Z5 R; [. \This service just checks a flag.& c# m+ f$ g( M' K8 K5 A  [6 L
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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