找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% a! H- ~" S2 o0 x5 s/ x
<TBODY>) i* y2 M6 ?. G7 E: C3 s
<TR>! @3 P$ E, F  w* j, O. w) n
<TD><PRE>Method 01 ! s5 ?$ {/ s; H  W
=========
% ]9 p6 I3 O# [
0 o, K: q- R- }  [! v; Y2 S' |& ~This method of detection of SoftICE (as well as the following one) is  p+ o$ S2 Q* o, L5 V- d
used by the majority of packers/encryptors found on Internet.+ D* k7 x2 Z" F2 S+ B& {% C6 N
It seeks the signature of BoundsChecker in SoftICE& I3 m; s: r$ [6 u' J! u

" [  b( q4 v& ^, y3 W0 o% _    mov     ebp, 04243484Bh        ; 'BCHK'
" c; Q) }' s9 ^# K7 T    mov     ax, 04h: _) m4 L) R: V0 q
    int     3       ; y3 G' P% W- e
    cmp     al,4
! r; [0 f8 F1 Z: \    jnz     SoftICE_Detected; k* P# \+ Z9 r2 |5 f8 w$ c
! L2 C% n% R. Q( I
___________________________________________________________________________
. ~  V, g  r5 }/ v  ~: n' s6 S+ A- J8 M+ g  {4 N: W5 A$ t# ~
Method 02
) `2 t$ ?2 H( K5 \/ h; s3 C=========2 Z5 }6 r. |) c% C4 X& F7 ]9 J
6 ]" [1 [; K5 F! g$ R1 M: J
Still a method very much used (perhaps the most frequent one).  It is used
& h8 v' D. S" O% p" Wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ L- a. b, l: U; Ror execute SoftICE commands...
9 {. Y! X. b0 ^% ~7 H& M; zIt is also used to crash SoftICE and to force it to execute any commands9 z5 l) e8 X' i
(HBOOT...) :-((  / s; Y3 ?$ A+ n
3 N6 Y# A/ `: r, k  H1 x
Here is a quick description:
  _" P1 C& ^; @& G-AX = 0910h   (Display string in SIce windows)! C) _& m8 z/ K/ E. D" c
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
- K2 M! f+ V/ k1 ]" ]-AX = 0912h   (Get breakpoint infos)$ C* w% x/ f9 q; g
-AX = 0913h   (Set Sice breakpoints)
$ R* B' E( L, F-AX = 0914h   (Remove SIce breakoints); Q7 F6 R/ O. @0 W/ v
0 ~+ t. r9 X7 @' @7 O# `
Each time you'll meet this trick, you'll see:
# W; _9 w8 V  x' B-SI = 4647h! {9 K2 D! e9 q+ Q1 l) z/ X% U- O; d0 L
-DI = 4A4Dh
% ?/ q9 B! P, N" F5 bWhich are the 'magic values' used by SoftIce.) D2 s1 r% N9 \/ _% S8 D
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; c( C1 ^; C. z6 L5 Z

6 m2 R4 }2 h4 X# T- Q. O1 L+ eHere is one example from the file "Haspinst.exe" which is the dongle HASP) ]0 U  T8 f5 V3 ]1 B* [5 y
Envelope utility use to protect DOS applications:
8 d6 |! i! p0 j$ q7 ]7 d& a5 `
8 P6 V# m0 Z; K  N4 d) }1 e( z- x  U
. W1 r- r2 h  n+ l4C19:0095   MOV    AX,0911  ; execute command.8 O+ z& F; s2 \# {
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., b) I. w/ {! V# h
4C19:009A   MOV    SI,4647  ; 1st magic value.
0 x9 t2 p4 ~- |1 _8 e" y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.- |8 a; H: t+ e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' t# M0 H" n6 r0 a; p6 \2 D4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, b' O7 J% @  }, ?6 A0 F# J! J4C19:00A4   INC    CX7 o6 R- h- g: ~7 w% o. P
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 J! \" X$ z9 G4C19:00A8   JB     0095     ; 6 different commands.3 A! Y" S' I5 C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.8 f) k1 H0 m9 b( G
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! M* Z* b4 S' ~9 c

$ X6 q4 _- r( [3 kThe program will execute 6 different SIce commands located at ds:dx, which' A" [5 ~: l* q, D$ L' ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: ?  H5 M4 x6 ?, d, l! r8 u: @. P

1 [, D( O' y6 W* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
+ E# r4 e4 m/ P: ]! ~, l; |  n___________________________________________________________________________, \( g( d7 F' R* ?  S7 |

6 c2 _- Q9 R7 A- ~! Y/ v
& \. m  ~4 N: v- HMethod 03
, \" r) I# z/ F. X3 X=========, f2 T* u$ R2 ?/ F/ k

1 R' I# |$ Y' u" v2 B% R1 SLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 G( v0 _. B# m, R, Q6 o2 i9 W0 H
(API Get entry point)
! ^7 }6 _. Q; \        
4 ~1 b: T8 T' ?% U2 ?9 b0 t0 T$ q7 }3 }7 F8 _% w
    xor     di,di( Y! L; d. V& v# W
    mov     es,di; [9 t  b9 ^* h  w& k
    mov     ax, 1684h      
/ G8 m! a0 U; h8 b  T( C    mov     bx, 0202h       ; VxD ID of winice) R! r0 W" u3 F: X$ f
    int     2Fh
0 L3 k! D. Q* x  q8 ~4 \: P    mov     ax, es          ; ES:DI -&gt; VxD API entry point, L0 g$ |) j' ]" j8 U5 G0 h2 A7 U0 R
    add     ax, di
2 |5 U) f9 @& M$ @5 S$ q4 J    test    ax,ax
, [& Z9 O2 N' I, O    jnz     SoftICE_Detected4 ^+ h, g6 p- t4 ~
5 N8 n& V! G1 s0 n% C
___________________________________________________________________________. U+ y$ s3 w6 N
% E+ L! J; z1 k6 E' K+ ^/ K
Method 045 q0 l# G; `# j1 Q0 E% O
=========- I* ]3 `. \# {) S
0 b% j% r: q, }7 X& V
Method identical to the preceding one except that it seeks the ID of SoftICE
$ B& h# ]( Q' n1 RGFX VxD.
2 P9 m( Q  {$ @% o( m2 z, v* G  w3 ]. K3 D* c5 T- N. `
    xor     di,di* Q% `' W+ A- O0 I3 `3 B0 v
    mov     es,di$ c# K3 q% B; \3 O
    mov     ax, 1684h      
( |4 r- J, D4 |/ e" X! u. Z    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ I. k; i# W+ ^! b5 e3 q$ p    int     2fh: u: N. K& ^8 v& V" ]; h& B
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# |) W# [" @8 @/ q% q/ ^    add     ax, di
# _3 m9 E8 `+ U8 r    test    ax,ax2 Z$ [4 S% `1 s1 D
    jnz     SoftICE_Detected) Y3 g. @8 \# E5 p- m
9 w1 @5 G1 `5 P" f# f+ ^* ^
__________________________________________________________________________
* `4 q7 f* Q; g3 z' }; ~
: B# n* {$ r; q: @' V+ F5 T. M4 ~/ o" t4 y- w- P- |
Method 05
4 w  C" v& a% k) Z! X  I=========
4 V( w% u7 F! F$ X! r7 g9 K9 ^; K8 C0 l, Q! Y
Method seeking the 'magic number' 0F386h returned (in ax) by all system
( C5 t" N$ y& Q1 \! m9 y0 x$ bdebugger. It calls the int 41h, function 4Fh.5 I9 B0 h9 ?. g. C/ g6 F0 Z
There are several alternatives.  4 h) x4 O  w" R$ `! |+ S7 B% `5 _
) {0 H1 o! d8 q/ B$ C' y5 y1 n
The following one is the simplest:
& S& s# T( _$ a+ f7 e* V* T. Y2 @& Y+ B& _8 \  T
    mov     ax,4fh
0 W7 T. F% O1 q3 T    int     41h
% L. k. o. X) x! R2 `. F5 N    cmp     ax, 0F386% F9 e; _, g: X
    jz      SoftICE_detected% ]3 Q3 N$ s/ w

0 H4 a( G5 N" E8 b" u# A6 u5 S* _
2 X# B8 I. }! ZNext method as well as the following one are 2 examples from Stone's % T- b7 _: l2 w4 d
"stn-wid.zip" (www.cracking.net):
: w: D/ w+ E" v: W. |
8 s, c% S  x0 |3 M3 B4 G; I    mov     bx, cs( e2 y& F/ U. \9 y3 h+ L
    lea     dx, int41handler2: U, W) [6 F8 M; z- }/ M4 P" D/ x1 R
    xchg    dx, es:[41h*4]
& ^+ o) D9 j" H8 \6 o    xchg    bx, es:[41h*4+2]3 c+ [( ^0 }6 B( X! R7 Z3 C& z  ^
    mov     ax,4fh2 W- p" L6 @/ C! c9 [. N' ]
    int     41h% A/ j0 Y7 @5 B% U
    xchg    dx, es:[41h*4]
  Q; `: ^+ n2 S. D' j$ T, ]/ h. {    xchg    bx, es:[41h*4+2]+ V( B, l; f' v2 G5 |
    cmp     ax, 0f386h. m. n, I# E  x$ k# @1 f' F( v) n
    jz      SoftICE_detected
8 R* p6 j7 b4 F6 R, N( K: `7 I7 [: d3 S6 L0 q
int41handler2 PROC
: x  A  M! k) W, j( c    iret+ c- ^5 d" C6 }& u0 w
int41handler2 ENDP7 o7 s% u1 j7 T. n
) O6 v; ^% j5 B! f, X8 O
% k/ T6 C( [9 n$ _' t' F
_________________________________________________________________________
  e7 c5 s  h0 M3 r2 q; f- S0 d% Y
8 |, H$ K; x- v+ A# J+ Y
7 _. c8 U9 ]7 L  v8 qMethod 06  ^' m8 Z4 }/ r+ D
=========
7 R8 L% z1 U$ k+ i
7 F" D8 r, R0 U9 L8 E" P# J( e% k4 [, c. {( n# x! q. [7 i
2nd method similar to the preceding one but more difficult to detect:
9 S. b+ d) m) F5 T. h, E8 y4 S# [0 u$ n) G

/ Z+ C1 j9 ?$ M0 W2 kint41handler PROC( M, x. G- P5 \3 o
    mov     cl,al
! N' G0 W7 I$ o( o4 F! h    iret
0 B+ Q6 q' c# ]) o% k6 aint41handler ENDP
. k' q" j! u' i' X
8 C# n8 }* k' N
* Z- D" ~& R9 w: U    xor     ax,ax* X" p0 Q8 W# x8 Z# e; Q% B
    mov     es,ax  w# I4 ?$ O6 I  _/ f; |
    mov     bx, cs
4 z: \. {4 L) c& F% c    lea     dx, int41handler
; P" J& a/ g$ r, t4 K    xchg    dx, es:[41h*4]% N4 F2 t/ |* A$ E+ L
    xchg    bx, es:[41h*4+2]
9 u7 c: R, N' l4 E0 B    in      al, 40h* X+ j' V6 t; `5 A" i
    xor     cx,cx9 L9 d4 Z- b6 K7 x8 u1 y. {
    int     41h0 ?5 e2 t, W" t% p2 J
    xchg    dx, es:[41h*4]
  A8 k- s" d0 X% S+ i) O    xchg    bx, es:[41h*4+2]
1 K, n# x  @; K) h    cmp     cl,al. K( s/ h/ O# A" F; E
    jnz     SoftICE_detected
9 K3 R) S, Z$ U8 _7 |$ a% t
3 v; {5 X3 T" `$ Y5 b# [_________________________________________________________________________
4 q$ s. F, k3 k) F
' y+ @4 g+ d4 }, t7 Z! y  W  fMethod 07
* c+ N% L4 K- ?( S2 o9 x2 ~# C=========, t7 C4 T$ Q/ U7 {  z  k1 p
7 M4 ^7 Z% t1 q8 M5 E9 }
Method of detection of the WinICE handler in the int68h (V86)
, D6 T' o) `( m2 I6 D! F" x3 n4 K
    mov     ah,43h
9 i2 ~) p. e( F" F5 s) U! X    int     68h
% n; f' v  P) [, J; ~) q4 J' H    cmp     ax,0F386h, ]1 Y+ [& N9 M/ n' w, R
    jz      SoftICE_Detected
( e0 ^, Z5 U! `# l: o# @5 `' z
* p1 ?; m% R/ [$ I
8 u$ F* P0 k; @, S& V7 }, M=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& }- B" J& ~2 a3 p+ O! H& ]4 H  V4 @3 {
   app like this:
: {/ `) o+ R2 X6 a! O7 o
! {3 y7 c0 H* S( j3 P; I9 o   BPX exec_int if ax==687 E# l$ |3 g) l1 A/ z& _
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ V( S9 z4 z, @9 |6 i/ q1 x" ^- \   located at [ebp+48h] for 32Bit apps)
! m* m  B% T4 y7 T& T  ^9 ^- N7 w/ H__________________________________________________________________________+ w2 j3 J9 A% ~$ T! k

- f1 n' |% C) Q) m8 N: a: W$ c: U" D7 |2 b: k7 t( y2 m8 u. B
Method 089 b5 d& `/ v% \
=========% p) p* @0 }5 \' G3 \  e) N: E
$ u1 m5 [; p* R7 L
It is not a method of detection of SoftICE but a possibility to crash the5 d6 q+ r, n% d9 ^7 o# _7 b
system by intercepting int 01h and int 03h and redirecting them to another& c: P+ G+ ^; U' s% v8 U7 q6 b
routine.) ?+ u3 w* X) A  e
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, j$ i/ r: f3 E
to the new routine to execute (hangs computer...)9 v0 S: Q; d) K& ~% R5 I' y7 R

+ T, c$ n, ?3 F    mov     ah, 25h& A2 r2 w- ]1 V' o. ^4 X
    mov     al, Int_Number (01h or 03h)( @1 y! P; A7 W% Q/ o
    mov     dx, offset New_Int_Routine( {7 T6 T. V/ G- a( @
    int     21h( C0 N( B8 ^3 t7 a# l- {) O
  Y- z* s2 s: n$ T
__________________________________________________________________________
& s: k: a3 j; N. S2 H: _3 `: ^( i* P! F4 i
Method 09' R7 V7 x) ~$ x. a
=========1 f* K; E2 X3 @7 w" y" S* W: h
+ T7 L& d% R' h& M5 s0 U
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ j" z  C3 i0 F5 _
performed in ring0 (VxD or a ring3 app using the VxdCall).7 D) @9 y9 [' Z8 B+ v2 \( w
The Get_DDB service is used to determine whether or not a VxD is installed7 ]/ ~  c. l4 Z2 X% s4 i
for the specified device and returns a Device Description Block (in ecx) for8 S, P% c8 C! E9 J6 _3 E
that device if it is installed.
. }. r5 m- E. C4 F% W7 k8 d& z+ w- N
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( _, j: Q) t; R   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& }3 n4 Z7 d8 }$ g   VMMCall Get_DDB
. \# z& l) w8 w+ y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& I. k% p; I4 t, l  ?: T: Z3 t2 I0 A! T
Note as well that you can easily detect this method with SoftICE:: h. k0 l/ L6 N) R/ u8 q8 b& v4 T
   bpx Get_DDB if ax==0202 || ax==7a5fh; n7 |, c  S  d, e

- E7 U; Q  e" ^__________________________________________________________________________
# @* q$ M+ ]0 p$ u; o9 d$ R( Z$ R1 _. O' ~$ v( e* B
Method 10
* ]6 d/ M* ?% w* e=========
1 W# V+ R' j! z
; \1 N9 w0 i7 n7 i* J: j=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
, o5 i7 }; h: E& J0 p" X- d& X: p6 M( {  SoftICE while the option is enable!!, S! X- M( A+ M# {- K

0 P) B; X) a1 ~, }8 {* x3 `3 ?This trick is very efficient:7 c' _# M" m7 m# ~1 O
by checking the Debug Registers, you can detect if SoftICE is loaded& E: {9 F$ }. U! {' _" G1 [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. R  s9 U1 c) a) X9 C, F/ e4 t8 Z( a
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 Q; t/ i0 D- r% ^% i1 i- n% L4 V' Rvalue (in ring0 only). Values can be manipulated and or changed as well1 [) c! t. F8 y$ ?
(clearing BPMs for instance)* O& _* _: U+ f9 q' S. Q# P: e

6 a+ i* ~& o4 b1 E3 y1 W9 V__________________________________________________________________________' i- Z7 f5 B" w# n% B' q

1 }' o9 ^, z" tMethod 11
  {; A, J1 ~* W1 x2 Y2 ~=========) u7 m5 H$ V# I* I

7 \* w; `7 i) S3 L) }" n. J  h+ y) z/ wThis method is most known as 'MeltICE' because it has been freely distributed% J$ S' J& Y! q0 N
via www.winfiles.com. However it was first used by NuMega people to allow5 `& s( }+ F: v3 x! Y2 i
Symbol Loader to check if SoftICE was active or not (the code is located
, ~1 B  T$ Q9 w2 k" _! @inside nmtrans.dll).
6 n( W2 Y7 e( Y3 @6 ~" M% J4 N2 Z5 c
" J+ p7 z6 v: a% J( RThe way it works is very simple:
; d. D5 r! g, a  @It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
5 G0 n/ N- `+ E% C& `2 CWinNT) with the CreateFileA API.
1 O$ u7 ?( T, |2 [/ P2 \
6 _  c* y$ Y  k) V: ^$ I0 ~Here is a sample (checking for 'SICE'):& ]7 L' ~- z, y& w; f/ Q% I5 _8 [; E0 i
. \* c  q/ B( u& T: r* ?. k
BOOL IsSoftIce95Loaded()
. @" t- f/ Y$ t8 m) O* q" O* P. I: N{" m  y8 O# |; [: o7 l  e
   HANDLE hFile;  
; z2 H0 Z" b$ `/ D   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  ]* G. a/ ~2 U
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. C) c) h. r7 ]+ F
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);) h& @% H5 N# z' d( d
   if( hFile != INVALID_HANDLE_VALUE )
9 ^8 \* Y3 A  g/ h6 [0 o' u   {8 k1 q; X: q" d0 s! ^: Y
      CloseHandle(hFile);
% ?! W1 a( p* g. K      return TRUE;% v% C9 u5 N5 U) G5 M& P. Z$ W
   }( {5 L) P9 T% x: T
   return FALSE;
1 U9 [& K  S% L' D0 i9 j' x( N, Z" h}
- O7 |/ ^3 |) \9 a, h  v  {( T7 F
Although this trick calls the CreateFileA function, don't even expect to be
5 D/ |) T) O1 Q1 `able to intercept it by installing a IFS hook: it will not work, no way!/ B( E7 @3 a! _! E3 A9 J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ I: D! p: k' d' l4 lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)  `" v* m& N# v0 s
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( W  R: R4 H7 l+ W. ?" l- `
field.: A( h/ w' K5 Q! ^" O
In fact, its purpose is not to load/unload VxDs but only to send a 2 n9 S% p( d6 M' N) q/ U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 w9 ~5 j4 i+ O& G
to the VxD Control_Dispatch proc (how the hell a shareware soft could try# c! w. k; w, @' _* V4 P9 m: f
to load/unload a non-dynamically loadable driver such as SoftICE ;-).9 Z$ a# m- u1 M1 {. g+ V5 |
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# Z6 f7 A0 Y) b' A7 b; ?5 G  Iits handle to be opened and then, will be detected.6 P/ J4 g# X7 Y; }/ l) Z
You can check that simply by hooking Winice.exe control proc entry point) \) i2 w- I% o
while running MeltICE.
2 F; T) K- q- f9 Q, v, ]% N& H% g9 p% E* i2 z

* n/ c6 q5 e  h8 o+ X  00401067:  push      00402025    ; \\.\SICE& o1 r% _4 c1 Q! O
  0040106C:  call      CreateFileA% `. v# L- J5 a. p4 `1 S8 n
  00401071:  cmp       eax,-001
, u) r- f! t! J! e4 D. z  00401074:  je        004010913 {- K( Q. P$ F  }, @

7 q5 h& _. P$ V+ w
9 j# N6 N8 r: L$ F/ {6 r4 k) `8 T. MThere could be hundreds of BPX you could use to detect this trick.
' j5 G  K4 ?& H, }/ t8 W-The most classical one is:1 G2 `( u. @; M3 x
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 L/ E, j# Y5 y) K
    *(esp-&gt;4+4)=='NTIC'
/ m7 Q: ~3 Q; F# B5 j5 L
6 ?3 v' k" u% V4 U1 a$ ~! d-The most exotic ones (could be very slooooow :-(0 {/ |) t# I0 v
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 x% b' [5 z& {. p" D$ @5 \( Z5 z$ p     ;will break 3 times :-(
0 O5 V( g; A1 c( y) B  @- v. \1 s7 g7 `9 Y6 B
-or (a bit) faster: ! ^5 K$ q" }4 X/ S( r
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" x0 ?; D  t1 J9 ?6 ?7 A
& _: Z8 w: y, G' j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 Y" M$ {) T0 u6 u& Z     ;will break 3 times :-(
% p+ i- o7 T( @8 C8 a6 u& q5 I4 Q) S6 G& J* s. q5 R& G! a/ p
-Much faster:
. A* y# X, P/ a# }   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 _% l! _/ k8 {+ ^  ~3 p  r! ~! A4 B5 M7 }
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. q7 A3 O. l# E! g! O9 N* d0 wfunction to do the same job:
; e% V* \+ O0 V  T
0 |; o  I* _' Z: A, W+ ?) V   push    00                        ; OF_READ1 H6 a5 J& Z* J: _2 L  s+ c
   mov     eax,[00656634]            ; '\\.\SICE',0
  E$ `6 o. V4 x: G1 K   push    eax
; v. [2 N$ c. |$ O: c   call    KERNEL32!_lopen
0 V6 x: ]9 K7 g; y   inc     eax
1 Q7 s: _4 d. j( x. d6 h+ X0 L   jnz     00650589                  ; detected6 ^1 [9 h: b- a0 G6 _# ^
   push    00                        ; OF_READ" ]6 T- l$ ~  Z' m
   mov     eax,[00656638]            ; '\\.\SICE'
' Y" v6 |; D' O   push    eax' m! _( s* R& c5 @5 D& n
   call    KERNEL32!_lopen7 C7 d& b6 }- e. R/ e2 R% t1 i: s
   inc     eax
$ `0 m  K7 ?/ B- I   jz      006505ae                  ; not detected+ B) `( S. h0 E+ \% F% ]3 u

5 t7 A8 L4 Q4 r) N* X( V5 a
, h& _& V) l; G0 P. s# E0 m__________________________________________________________________________  w- }  |3 x4 ^1 E# r1 M3 i
3 t3 ?# X8 p( m/ u5 G
Method 120 c) p0 g9 W) @  t8 c. W
=========
+ d7 f' Q; J& p- d) m" f) Q: m$ @; b3 ?/ I' I" `
This trick is similar to int41h/4fh Debugger installation check (code 05. Q7 D$ f0 ^# E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)$ Y- X2 m; z" Z1 j, U& Q  U0 Y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 u4 H& W2 ^% g) M. G  B
+ p) }7 v, w2 M( k  e5 S
   push  0000004fh         ; function 4fh
6 \; A- s3 l  Y4 }+ [   push  002a002ah         ; high word specifies which VxD (VWIN32)
' H$ b5 p9 ^. y3 l                           ; low word specifies which service# d2 B9 r/ g- n4 X! S
                             (VWIN32_Int41Dispatch)! f% t8 H% @+ ?2 o" u
   call  Kernel32!ORD_001  ; VxdCall7 M8 n* X- z! e2 @. z
   cmp   ax, 0f386h        ; magic number returned by system debuggers0 W9 Z/ D# o- c" a" B! h$ p
   jz    SoftICE_detected8 q( b4 K4 v% I  ~8 C7 D

5 |# K( O7 ]3 ~4 n  lHere again, several ways to detect it:6 @+ N( E8 a6 H, J  M

, K  s/ A! l& R. f* k: M    BPINT 41 if ax==4f3 ~* y. y2 u: [& W; h
: A% M- g% Y& P3 W3 j8 z3 @0 x  q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 T# T. {1 I+ V  }

7 ?: a7 J1 p6 a* M) n4 s* ], O* F    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A$ _$ X7 g3 i# B) v* i4 k3 G5 |+ ?

# R, x3 E$ x( y& M    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!, p" a9 Q3 ~2 V' o- S
, Y4 t  f, Y- U
__________________________________________________________________________& B4 ?6 N' z; i& @6 \5 D

( X0 g: S' ?; z+ HMethod 13$ U0 z2 g+ e+ S
=========5 h3 G& _: }/ f+ e9 D
5 R* W5 |4 b9 N+ r
Not a real method of detection, but a good way to know if SoftICE is5 D* U& }% \( F, |; N3 E
installed on a computer and to locate its installation directory.' o, {2 o$ [" }- t
It is used by few softs which access the following registry keys (usually #2) :8 c7 X# r, X' A4 q! l
; K! l: y; z) x( u. y/ b5 [& j
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 j8 [  Z3 Q' Q" [2 m# N
\Uninstall\SoftICE
0 L4 j) z! P, i, E" B, r3 I-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 y8 H9 }- V1 a; j-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# a2 |4 U& Y5 u0 Q0 t" g
\App Paths\Loader32.Exe
. r( ~2 |$ _  I9 ^: x7 r- x* Z5 ]8 c) I$ Y; T7 L
% V0 E! c- _' ?3 ?: c! T& v
Note that some nasty apps could then erase all files from SoftICE directory. C% r0 D  s2 A: m
(I faced that once :-(1 t! u9 g5 S, i, ]# G) v
5 m. p, d4 u8 l5 M1 {% J4 i
Useful breakpoint to detect it:
' J/ ?* v& J+ R" h1 l9 p$ {0 h6 v# D
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 y6 y5 W; |4 L3 t# Y" _% l9 @+ z2 I# D0 p
__________________________________________________________________________
/ ^8 g+ i5 ~) N, N0 O% d
: B3 U" O" z1 [% W3 c1 d/ F! N% f+ ?
Method 14 3 W/ u4 V0 E' F2 d
=========% t* t5 d9 }8 |1 o

: o2 f& \8 Q7 G/ v$ `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
% Z$ _4 W* J9 N/ Q$ Y& Gis to determines whether a debugger is running on your system (ring0 only).0 T9 N% W( j4 g* K' O! B
; s% J! I' x, ^( r( ~8 s# w
   VMMCall Test_Debug_Installed
8 B4 U5 G) M# ]- `   je      not_installed
& X! `% z8 H  O0 f# ^# G- c6 o' {5 m# o0 R- J6 X6 p$ _% {
This service just checks a flag.
+ ~; e. \; W; F3 L% }& A; r</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-28 07:45

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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