找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 {% m8 F: U6 f
<TBODY>( _, @# X) d: G' e, c' b1 J
<TR>
# t, E. ?1 Z0 E5 r6 d6 C0 h- e<TD><PRE>Method 01
. Z! {, {: v: ~=========7 H; y3 |  d4 ~! z1 L4 u- I' ^: V

0 f, s2 L& J. H) B4 A/ X, r# d' OThis method of detection of SoftICE (as well as the following one) is# H0 K3 L: m% y/ p6 C* k
used by the majority of packers/encryptors found on Internet.
4 s% [0 k3 c# }+ t( \) [It seeks the signature of BoundsChecker in SoftICE
. |4 `: b# }4 C) o0 h
# j* ~, J: v& P! d- U  V    mov     ebp, 04243484Bh        ; 'BCHK'
1 c/ d6 I# u+ x4 V( o# ~) }    mov     ax, 04h8 U) ]" R. k$ u4 C
    int     3      
8 w" Y" t: e% P( U/ }  i# Q& a    cmp     al,4
4 x6 a$ P  C: p& U, C  G1 m; c; o    jnz     SoftICE_Detected8 V" ^9 F" Q, G6 Z7 ^

+ J% l+ ^$ J7 r& o___________________________________________________________________________- @7 [4 i8 U4 Q' c
  o/ Y6 k. f3 q: z7 |% N
Method 02) X& j* f3 h0 u3 I% T: h" N
=========
9 K; g1 G2 g! W: d# Y/ s0 {8 v* e5 j# X) @. d
Still a method very much used (perhaps the most frequent one).  It is used3 d1 L: f9 W. z! s& f1 {5 z" i% ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,. }# v. G+ F4 m3 ?% T+ p" ?
or execute SoftICE commands...! I- d/ Y1 v& N6 b% T
It is also used to crash SoftICE and to force it to execute any commands
/ A0 F$ g; G9 _. R4 c, l% y(HBOOT...) :-((  5 W* r# d$ y& _( ~
3 w# q4 N0 I7 ~% x- h* m
Here is a quick description:4 _, r" ^' q* G7 o9 x% p( E
-AX = 0910h   (Display string in SIce windows)* H8 y9 a% {* {0 j9 h4 a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- y" _$ A9 W: S1 w0 b) [3 f. r+ r" r& e-AX = 0912h   (Get breakpoint infos). Z- h( h4 s; y" X8 W
-AX = 0913h   (Set Sice breakpoints): c: ~, b( k5 N* T/ C0 l
-AX = 0914h   (Remove SIce breakoints)1 C8 ]  P' [" d- r! S
0 E- s) ^4 z3 O! C  A! w
Each time you'll meet this trick, you'll see:% m4 y% i1 T: _0 s2 o7 t8 V
-SI = 4647h
4 k) K) ~9 `5 w( ^, q# O2 x. O" u-DI = 4A4Dh0 o4 P% z5 A- o8 d4 j
Which are the 'magic values' used by SoftIce.$ Q+ A; }% g* Z9 P
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. e  `. v$ G1 t
+ f7 E2 @" f# R& i
Here is one example from the file "Haspinst.exe" which is the dongle HASP. D9 h+ w  o% v+ J, I
Envelope utility use to protect DOS applications:
2 W7 h; X3 {) G( E) V9 u+ E4 }2 ~( K0 b* L$ h5 R, A, l& R3 R

0 h  z, P7 l! r! [) F3 S) O- \' V4C19:0095   MOV    AX,0911  ; execute command." m3 Y, h6 `: R; R: U
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 Q5 d2 Y/ y3 _4 d- T# T- T( F7 j
4C19:009A   MOV    SI,4647  ; 1st magic value.
' m+ y2 U9 m! p* m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. p  l- S+ S. u% j- G% v4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)/ z7 v3 ~0 v% F; C% I
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute3 P1 c" C4 J, {9 b% k$ H6 o
4C19:00A4   INC    CX
5 L3 u) U8 n$ D2 K3 w) H4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 L0 D" }) y4 ^& m7 S: e, z4C19:00A8   JB     0095     ; 6 different commands.
0 W  l. u+ K% z+ ^/ w' a+ C8 I4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ P6 a4 e/ ^( y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! V0 O# ]5 d# `2 b! w8 R$ `5 J
& E& q& N# o  @2 b) v/ n; c
The program will execute 6 different SIce commands located at ds:dx, which
" I9 a( B) K2 A! n& s' ^are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.  K) v) L: f+ u* M

5 f/ w$ I! k$ N* h- F2 E  m0 G* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
7 D- C3 ^' O- }+ |8 G___________________________________________________________________________
8 m# O9 s2 {( p- ]& Q2 w9 ?
0 d4 P/ Y/ p% J$ p( Z4 Z& L7 e) B/ T( Y$ x- O
Method 03
6 t# J! o* q2 q: v4 z& m) A. G, A- U=========* ~1 B8 Y; W/ m! m9 l* V0 s
0 G; s  L, `4 _3 T2 u) a# J
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* x  G7 B7 E% B, K9 g
(API Get entry point)
( h) D' B  Y. J9 \! B        . P) A% A$ n$ d8 e

& h. t" F1 _4 S% S9 S+ v" d* W2 ~  l) d    xor     di,di" Z7 u: T/ W+ {, {1 f
    mov     es,di
( X! K) R9 Y* S9 j5 Y: J+ W    mov     ax, 1684h       % w& e' m: ?3 J; {- ^2 z# s* x; v9 Y
    mov     bx, 0202h       ; VxD ID of winice& N% s. j- c0 {6 y/ e* }4 d6 Z
    int     2Fh
2 ]( I. ^2 P2 D/ F: V( R; t    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: H$ S4 N) G: P. E9 N5 }% f" [, X5 u    add     ax, di
6 w0 S7 h+ b" G4 }8 K    test    ax,ax
1 ], d& ]2 w8 i2 x    jnz     SoftICE_Detected7 v6 X% K* R' [& z- l0 P

4 a: a- f: I8 O9 ?; V1 M___________________________________________________________________________
" m5 p0 j: t* X0 }4 i
" o, ~- p$ a" {+ n" Y9 b: D: J. GMethod 04
6 S. D6 Y4 d: ?  O' u! ]: H/ x. Y=========5 w* B& C: u6 H  g# B

, F& n9 v- b0 Z8 _Method identical to the preceding one except that it seeks the ID of SoftICE  I' C' w0 }4 Z( B5 W) n2 {
GFX VxD.0 a; Y" v9 k. n0 G: S

" {( z7 O5 k3 s" S( G3 Z- d; I    xor     di,di
$ i: i4 S" H! v/ s' J1 q: d    mov     es,di
6 E! a% k# x/ ], u7 R    mov     ax, 1684h       , `# K% I  A7 p  ~: |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  G. g( B4 l  ?! _. T    int     2fh( F/ h* L+ |) P* t0 F" c
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 {$ V: ^" y. c    add     ax, di' N2 v' h$ b0 p
    test    ax,ax1 x# {: E( _# g) A1 E7 L9 w
    jnz     SoftICE_Detected
* x) f+ r5 n8 G8 W  W: y, I' _. |) ?( n" V( ?
__________________________________________________________________________3 @  T' h( I' l& n, `$ n$ ?

  X  E1 J$ X6 t. q: i/ |% A" Z7 i( c* t
Method 05
" `  D$ c6 I" l5 d8 ^=========! I/ z, o; j! h  {" A

( t4 @# v$ p$ w) M* P; [Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 X3 S+ P; k1 u$ D7 Mdebugger. It calls the int 41h, function 4Fh., j/ A  x) z: U* B# _( o2 f- f
There are several alternatives.  6 P/ x; L' A5 \$ h# R0 N

+ c& m6 A2 j% e7 BThe following one is the simplest:
1 S. [- U0 V3 C# K8 |7 E, Z
; P: J; L( t5 Y% ]    mov     ax,4fh
/ g) B" W( C  f$ L5 U) y6 g4 b    int     41h
, \6 n6 G) w8 W6 G) i& Z) X/ Z    cmp     ax, 0F386! _$ a" E4 Q/ T1 G/ E! [
    jz      SoftICE_detected( w3 u0 u8 G' i6 ?& q. \
! ^) o! g7 t/ h0 Z- c" k
$ s9 B4 l! e6 X$ b6 @+ ~
Next method as well as the following one are 2 examples from Stone's ( R2 N* {# q7 r: _
"stn-wid.zip" (www.cracking.net):
* F! K. Z# B0 J  M! h# i7 v3 }# e3 S* Q0 ~
    mov     bx, cs* c3 e! [) [' k" _) h6 Z3 e
    lea     dx, int41handler2
* {2 Y2 a: O9 X' A% [( N& O7 t/ u    xchg    dx, es:[41h*4]
0 e0 d& x; A9 Y% X5 D. D0 x2 [/ |    xchg    bx, es:[41h*4+2]; I  Y  ?& M* i. e. I
    mov     ax,4fh: P/ a! M& A# S! j8 P0 B
    int     41h9 [8 {" |- ~7 Q# Q
    xchg    dx, es:[41h*4]8 z; [* w5 _# C+ {3 S
    xchg    bx, es:[41h*4+2]- h! g4 Q2 z& r
    cmp     ax, 0f386h
. f$ W9 n) {7 U2 y. c6 g    jz      SoftICE_detected
" Z. m+ J& T: ?" t0 h
* A+ V/ p% x3 H8 r( I5 hint41handler2 PROC
! c" P- ?* P. W. \5 N, `, H' d    iret3 v6 h* H- D+ e; w
int41handler2 ENDP3 V( B+ A3 V  C2 d
! G! P6 b: {9 J

) ^2 r3 Y$ s, m0 ?& I" f_________________________________________________________________________
! a7 D5 J% Y  X) Y! I$ R5 l' }+ s" v. P
' `: g4 A8 c; Z
Method 06
0 R. f' ], t- p1 n=========; ?  m6 |$ q% j

8 u5 C2 [# v$ ~% h9 O) ^7 m, o
3 n; F  ?1 c. r8 ?2 |2nd method similar to the preceding one but more difficult to detect:* Y) `8 g$ ]/ |5 {$ m

& v' B" ]6 P& ]6 K# ?( v
; l, }7 D7 ?% N9 r" r9 ]/ Jint41handler PROC. A. y7 f' D7 W7 ^7 j  G8 H
    mov     cl,al
( R3 K4 a* ]5 m( F$ D0 x    iret6 H0 F1 }6 ~& ~/ ?% O' }3 L
int41handler ENDP
, b! ^% I8 S! [) ~4 t5 o& D6 Z. W: h# u3 l
+ S6 c8 R' {4 m" ]9 y# P# ]
    xor     ax,ax
0 G" z: Q' H+ m8 o, a' p    mov     es,ax; s- n3 [2 W' M. c2 }% H* L
    mov     bx, cs
, c) ?& Y5 m4 O' c# |5 ^    lea     dx, int41handler
0 g' e. L; s1 A9 q    xchg    dx, es:[41h*4]+ {: y2 ^$ Z; p
    xchg    bx, es:[41h*4+2]9 v; S9 u# r  ^8 D1 F6 D* k+ v7 ~0 [
    in      al, 40h
& d* ^; [0 g8 H+ S$ ~# o, n    xor     cx,cx
" m# w6 v( l5 C3 V  H2 w2 x    int     41h
  Q. p  S% t$ J1 v; r" M' i    xchg    dx, es:[41h*4]# Z# \) v* ]% G+ K. {
    xchg    bx, es:[41h*4+2]2 W- N+ m8 P  k! J
    cmp     cl,al/ A4 u( N# j) w4 y" {: a
    jnz     SoftICE_detected
4 L+ D& V1 h& e* p& J" S
2 L, v7 u# r4 x8 m" }! D8 L_________________________________________________________________________
7 G' r- I! C* x" u. f6 d7 Z$ p
# J  i4 L2 k6 {Method 07
* o7 R5 [: v* {$ y=========0 i8 l  k5 R& d! g. \2 q% l
5 L0 e5 E% C8 f. Z
Method of detection of the WinICE handler in the int68h (V86)( z5 F5 F1 r. h/ }3 T( H; k
- Z! ]# Z' k. b& |9 k' T
    mov     ah,43h! C$ U$ G2 `! p  B
    int     68h# k, `* t/ H  T$ h
    cmp     ax,0F386h
. D$ `6 D. C' X9 v0 V9 n    jz      SoftICE_Detected9 Q; c- N5 b' ~0 d' e
* B% E7 ^, A/ x. b

4 D8 w. U, X* Q! p3 {5 F=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 z7 y/ D. {. x% {( W) a" w" C   app like this:
' i4 x, D' x6 b6 W0 u/ @8 p8 [% D  A
   BPX exec_int if ax==68
5 L1 D$ g. ]) g4 Q+ T! U. U! [   (function called is located at byte ptr [ebp+1Dh] and client eip is
4 |; Q7 ^9 C5 c   located at [ebp+48h] for 32Bit apps)- h1 m2 P5 f: N8 {
__________________________________________________________________________, Z/ e% X5 i, _. _

1 m+ }* a; f, e# I  O+ {0 z5 ?
4 _8 M8 x9 n$ O% u; @& E8 VMethod 08
7 {8 I# [/ ^: T  ?- C1 z=========
4 d' t7 ~2 h5 H8 g$ T
& }1 v+ S# R' V" a6 m( JIt is not a method of detection of SoftICE but a possibility to crash the& Y4 [* f% e# ]2 a) \: u1 j
system by intercepting int 01h and int 03h and redirecting them to another) o0 ]% ~" @1 N. X, K* P6 ?
routine.( C4 x* e  J& X+ x  K# @
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
9 {# `1 A% S8 x* v! s' A+ ?) jto the new routine to execute (hangs computer...)  K  {. r4 c: Y6 {. r

/ H) R& {: I( l4 r0 ~    mov     ah, 25h2 |+ [% ]3 U* g, h( V- Z
    mov     al, Int_Number (01h or 03h)
" F& e1 W- m1 f- O, H  K4 n    mov     dx, offset New_Int_Routine
! y2 k3 F2 {( u! ]* i3 g! Q4 o$ E    int     21h% S$ _" f. K- X: _% [  o
1 x3 Y7 [. C$ ]$ Q  q# a
__________________________________________________________________________
2 O* I- W. u- O2 e  j; J1 W8 L
. m; u3 c+ ?8 n5 r9 H- nMethod 09* l/ t4 |0 H- W; x1 r( o, [
=========! q7 d+ R$ u+ o4 t5 Q, z
! ^- A) A# h) D! J3 _
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: q& w& j- x8 d) |performed in ring0 (VxD or a ring3 app using the VxdCall).5 z/ U9 C, @0 D3 s, a" z
The Get_DDB service is used to determine whether or not a VxD is installed' `1 _: b" _9 s: W+ Y) Q* a
for the specified device and returns a Device Description Block (in ecx) for" b7 P1 o$ {7 P. v9 }
that device if it is installed.$ k* l) [; z; ^  o' b: |
6 \& w4 X# W% Y* O2 O
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
, ~8 g1 N+ o4 U0 W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* K3 V6 @; J+ ]3 \8 k2 j" p   VMMCall Get_DDB% u% j( K: {$ P9 Y# O( X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, X1 N" p% ^" l! ^8 B  r& {/ M) f+ o0 R
Note as well that you can easily detect this method with SoftICE:
* D' b  q& J8 m  v   bpx Get_DDB if ax==0202 || ax==7a5fh3 z% C  B) i+ l. _2 ^

; Z. ?: o$ h& s" h2 @__________________________________________________________________________3 |# J/ }, B9 g
! |8 P4 @* D' o$ C# S
Method 10
. N3 O* b0 |. \8 R9 \=========
/ _: N1 B$ y) F$ ?8 j# x& b7 s% o: w: y* d
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
. i. u8 r1 C% M6 h6 g9 N  SoftICE while the option is enable!!( s0 [, S# g1 q2 n2 s

* y( f% ^- p& ~1 q/ c2 VThis trick is very efficient:
. U  L9 m4 e& r% x/ ]7 C. Rby checking the Debug Registers, you can detect if SoftICE is loaded
% n: Y% l3 }- k! q4 J; V; Y6 C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, z0 p( W0 @9 s9 z$ m+ }6 @. Kthere are some memory breakpoints set (dr0 to dr3) simply by reading their
/ S) E. u  ^- }& O# ~value (in ring0 only). Values can be manipulated and or changed as well
% w9 s0 [, U/ V# s(clearing BPMs for instance)
1 ^+ ~4 n3 a. U, i4 d8 T& W/ @* }: S! @  F  }2 C! S8 v% d/ p
__________________________________________________________________________4 i# J: i7 x3 G2 o8 U
: _" d4 I( _' A
Method 11
8 d& L- w) H8 m( O4 H" L8 D=========
, l! @3 ~" F# T0 g7 {( M6 \: j1 j
6 x3 i# x' O3 j/ HThis method is most known as 'MeltICE' because it has been freely distributed- p. T% x3 V& e, M
via www.winfiles.com. However it was first used by NuMega people to allow# q5 n" k2 i. i2 u4 f. u
Symbol Loader to check if SoftICE was active or not (the code is located
7 _0 r  J6 l; }+ U) f8 \inside nmtrans.dll).
8 z# k: m5 R4 w* J$ ~" E2 q! A6 J. p
  l3 \% {: z' L) A; @The way it works is very simple:% `. I; l6 y" E/ }, H
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for6 n# o) q$ k. X' ?8 t
WinNT) with the CreateFileA API.
3 i: J8 i$ h% K# U9 q' o9 U5 m/ [/ D6 F. D( J: K2 a4 |
Here is a sample (checking for 'SICE'):
+ _6 n( I+ \6 t+ c+ X
' [" u+ p3 L9 }3 Y5 V( |; Q# eBOOL IsSoftIce95Loaded()1 t+ i  n- A, l: t' i8 i
{! x4 p3 L5 H: t- i6 u
   HANDLE hFile;  
: @! ?, I. n$ v  Y+ ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ p( G! c  J, b( }                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. U& c5 ~/ K+ ~2 I                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ ?. J) E" A6 `. J- Z% Y( }   if( hFile != INVALID_HANDLE_VALUE )$ I  C6 E2 a4 o+ p. s
   {
1 k- ?" H' P) R4 M. y5 P3 l      CloseHandle(hFile);* {: e) U0 y$ q
      return TRUE;
& e9 O' ~* I+ r3 A: P: O   }
4 Q; }  R+ S# e9 `8 I% J  m8 D   return FALSE;
- s; Z  x& Q  |3 n0 S1 P' I6 c}6 P3 b3 u! k6 F
1 ^1 g6 i; P( q3 {* E
Although this trick calls the CreateFileA function, don't even expect to be3 i5 @2 Z. O3 w- |3 J; F
able to intercept it by installing a IFS hook: it will not work, no way!
+ F: ^7 m3 D% N% l2 kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
: x/ V0 _3 o/ ^& Lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 Q# V/ y7 u3 C* F! V8 v! C; x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" p$ d! I. f/ @0 l2 t  \field.
, _6 k0 K* s6 p; H7 C/ q- DIn fact, its purpose is not to load/unload VxDs but only to send a
& \. g5 O; q! G& |5 g. Z5 [) W9 iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, d& U( L1 m$ u: C! e% gto the VxD Control_Dispatch proc (how the hell a shareware soft could try
. k* ~$ ^3 z9 t# B% Bto load/unload a non-dynamically loadable driver such as SoftICE ;-).  i/ Y# @' J0 ^; L
If the VxD is loaded, it will always clear eax and the Carry flag to allow8 o3 F: a1 }) W- K8 a" q- n
its handle to be opened and then, will be detected.
* V( S+ b5 e( YYou can check that simply by hooking Winice.exe control proc entry point
8 F1 X% k5 N) U% O# vwhile running MeltICE.
6 P+ t) V0 }! D9 G0 j
: l  \" u# g0 J+ R7 Z2 x* \6 c( K6 L6 d) R; }
  00401067:  push      00402025    ; \\.\SICE' T% [% V* I& {: C& X; n
  0040106C:  call      CreateFileA
: f4 y* `6 N4 ^- n  00401071:  cmp       eax,-001# d9 ], v) I7 O/ ~4 {
  00401074:  je        00401091
6 c* `3 \( X6 Y# k
4 w, E3 E# B) ]0 p0 H: ~7 b1 o
+ m8 V2 i8 L1 }  F" r+ i0 UThere could be hundreds of BPX you could use to detect this trick.
' S$ u: L4 J2 w: O  ~+ g-The most classical one is:
8 m" b, Q1 }$ X6 A1 {5 a9 i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
0 n3 Y0 i+ i& @8 g5 ^) N4 v    *(esp-&gt;4+4)=='NTIC'# f2 o0 T) I7 X( u
: r, K/ H- y% \/ G
-The most exotic ones (could be very slooooow :-(4 a& ?4 N! E, K- ^
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% L2 Z3 f1 R# ]  G& K/ |     ;will break 3 times :-(
4 h# p/ g" u' y
- \. A6 B6 t* B. v-or (a bit) faster:
# g1 V, s8 v& x   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
* n9 F( L0 m& g' N' t1 R6 s
! L! a3 @: D' N* e9 t" ?   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! v8 s* |9 C+ J* c' q     ;will break 3 times :-(
5 J/ U/ S/ T' E
1 n. m# n' g: A  `1 n. k; b-Much faster:- b7 J: X+ w6 ^+ ]2 L) V$ R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'* C* l' J' O  \  W
. N  j* M7 }$ J& S5 t# p
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
" R2 k! ~% p# G( Sfunction to do the same job:
8 U5 b* S+ q. `% x0 G8 G5 I9 J; h9 L, @9 W0 J
   push    00                        ; OF_READ
: s# q  X; e( ~* r: t, E/ e   mov     eax,[00656634]            ; '\\.\SICE',0/ N2 T8 f0 I- q4 _* Q: e$ z6 M
   push    eax* Q4 O: J0 c( f7 D# o& V8 a- I
   call    KERNEL32!_lopen7 T' O* A- C8 C' @* s7 v9 c  P
   inc     eax# L$ L5 Q& \( D8 z) h4 x, @! g# I
   jnz     00650589                  ; detected
! V& ]$ D( v0 h/ g! v' `   push    00                        ; OF_READ$ A2 |2 a8 ~- w* e7 W2 @7 z
   mov     eax,[00656638]            ; '\\.\SICE'
6 i  U: K8 S+ ?' ~) m, }4 n2 R   push    eax
# z9 V+ l# @' s  R0 r) ^   call    KERNEL32!_lopen6 I2 U3 w. K) b
   inc     eax4 H+ I1 L8 x. m; _) |1 q+ [, O/ ]
   jz      006505ae                  ; not detected
3 }+ X5 D5 G9 a% n
( X1 \$ Y& N) ^9 |- M+ a! I9 Q
3 W: ]( ^4 L9 l& X9 p0 d+ o5 j: q__________________________________________________________________________
2 x9 v" @, h, u) k! }( d# J3 P8 x; ~; d  A. O, }# Q
Method 12& R$ C1 p6 u1 O3 J$ ^
=========, S, ]) i4 t: m; h% A

6 F0 l4 r8 h( W/ BThis trick is similar to int41h/4fh Debugger installation check (code 052 u# r: T, K% u9 v! f- u, ]
&amp; 06) but very limited because it's only available for Win95/98 (not NT)- P3 w9 O( d4 a( V
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) @6 ~& ?& c' V2 r. I7 r% _4 z7 |) v! g( W1 o) I
   push  0000004fh         ; function 4fh
% n2 p7 S. b7 v3 [$ l) i   push  002a002ah         ; high word specifies which VxD (VWIN32)% Y, I4 r- I! a8 X
                           ; low word specifies which service& k/ u. y9 R" G! v9 G
                             (VWIN32_Int41Dispatch)) s: z2 c6 Q6 T. Y
   call  Kernel32!ORD_001  ; VxdCall+ T: F; Q7 n3 T0 ^# Y- y7 r* W
   cmp   ax, 0f386h        ; magic number returned by system debuggers4 M$ ~* l" }. c" u$ ^. k
   jz    SoftICE_detected3 w8 q# A: V! G# m2 f/ Y5 T1 X

" g6 {; Q% |& j& V3 HHere again, several ways to detect it:
4 P7 u1 q. B2 e/ H8 A$ V  D% U- c
/ P# c+ U! w, b. \    BPINT 41 if ax==4f! C1 k8 U# a6 ]4 s3 a' h

( z# h1 [4 O9 l3 ?$ q: f    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, `9 H* C1 b7 [! Q1 B* m& ~3 O4 C3 V; r7 x2 a
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 L7 c* J( U- A4 L- M5 b+ ?7 g! H1 R

3 K+ N4 K8 J# w+ L7 [    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  E* t2 z  g- U% }) `/ l. v3 S
4 x7 B. d; R8 s# U, c__________________________________________________________________________
, T  I7 D8 L/ O0 x' F5 \) N9 D8 f: Q  Z! E9 t0 z
Method 13
' Z2 e  {0 m7 |=========
0 M2 z! ?# T4 g
+ C8 \2 w5 w) E: UNot a real method of detection, but a good way to know if SoftICE is
, O' {  w' |/ f$ S) P) t2 ?installed on a computer and to locate its installation directory./ X0 L9 h4 v' |# N
It is used by few softs which access the following registry keys (usually #2) :4 V+ _- H  _1 a- @- M: Z

6 B/ o8 c4 @( m- K( c, X-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! O" @# v/ z2 ~' j" G/ z\Uninstall\SoftICE
; b2 M8 k0 \+ t2 Q5 r9 P# h9 Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 Y8 k2 ^5 {2 l0 p$ p% @: p-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( e1 |8 V, }+ V1 c* i
\App Paths\Loader32.Exe
4 t! b& F- p4 X9 _$ @2 C1 L
" |5 R# e  O& {& O; U. `4 b) d6 t4 c0 m( u! P
Note that some nasty apps could then erase all files from SoftICE directory
! n  h% S5 ]9 c. Q. H! q1 [/ h(I faced that once :-(# M5 e4 _; G2 M* V& g

4 e2 y8 v4 q7 r. Z5 e2 a3 s" SUseful breakpoint to detect it:
# t# `0 T5 R: w5 ~" q- G
1 n6 X# P, C. \8 x! G" j     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'; Y$ r3 H+ y7 i. j; n. `1 v

* p- U  r1 K  a( q4 I7 Y__________________________________________________________________________
- ~4 L$ @% O3 H6 t6 b  m3 W+ h! p$ {+ q
: a6 w3 ?; L8 u+ V  p9 O0 M6 w
Method 14 * K2 o! V% v2 M
=========
3 z5 }8 w5 i7 n$ q' F$ Q, ]( n* i; S
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
6 e  ]& C: k  i. ]7 m+ Z0 Ris to determines whether a debugger is running on your system (ring0 only).+ H8 B4 ~6 k* c( s; F# U' k

- ]9 O' _) m; \; f; R   VMMCall Test_Debug_Installed% E6 v* C5 h" D  ~& `9 Y% _" v. j$ B
   je      not_installed
1 M9 K  I4 r  N$ m7 ]' N+ t; e; e; y( y5 n+ [. B9 g& A
This service just checks a flag.
9 [5 D- I1 Z1 B6 Z) H</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-4-2 11:31

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表