About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 i- k; c& N8 }- V( d$ l; |  x
<TBODY>
+ v: ], H# n( d( |/ y& C6 \: V<TR>
6 v$ g" a2 |8 J8 I1 a( Y  Z' m<TD><PRE>Method 01
' M' o9 B/ N+ ?=========+ V2 y. ]' o) w! f) c- {
7 F% w" F- r: e
This method of detection of SoftICE (as well as the following one) is
* ~& M, H+ u7 c$ W) `/ Eused by the majority of packers/encryptors found on Internet." N6 S% p2 g! ?$ u% _: n, p
It seeks the signature of BoundsChecker in SoftICE% |, s6 @  d+ W) e7 r1 I: H
; t# o( m. f0 o; H6 A
    mov     ebp, 04243484Bh        ; 'BCHK'; q) m  e( p4 r
    mov     ax, 04h+ Z4 ^& n1 w. l; o
    int     3      
$ u! U6 o3 C- J, `* y    cmp     al,41 ~" r2 w/ z7 J% h1 p* h
    jnz     SoftICE_Detected' s5 r8 b  A4 k2 q& `5 a
# s% y, R& S2 C1 q
___________________________________________________________________________
4 e7 W& S) |1 Y! ^
, f3 C  o; }+ ?' H; }8 ^Method 02! M: |: \3 p4 |9 A+ n
=========" U: v0 ^6 q" \$ l6 N  G
& ]( }5 v' [3 N3 |! r) b
Still a method very much used (perhaps the most frequent one).  It is used
! c4 [. O) ]% cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* P- U- d: d. M4 y$ kor execute SoftICE commands...4 M' P0 b* f# Z; ?# q: t
It is also used to crash SoftICE and to force it to execute any commands
4 J; c4 U  z- X(HBOOT...) :-((  ; M7 @  ]4 n( j0 a( U
* {- w! n+ w  L2 J4 @( ^
Here is a quick description:
/ Z9 ~/ \5 C# c-AX = 0910h   (Display string in SIce windows)
+ o6 r, w9 B  P7 f, t- C0 o8 ]5 y-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 @8 {- R- w# z) ~& Z( a-AX = 0912h   (Get breakpoint infos)) o4 c/ u" J# ]. L
-AX = 0913h   (Set Sice breakpoints)
# g$ ^) _/ \3 U3 b5 ]# p-AX = 0914h   (Remove SIce breakoints)
2 s! X+ b' m7 ~
- W' U  H0 i+ B" ZEach time you'll meet this trick, you'll see:/ R2 E0 N5 i1 W* g6 e: h  B- u
-SI = 4647h; H  h% S; ~& U/ h+ ]
-DI = 4A4Dh7 x$ T4 H& P; Q# H4 `
Which are the 'magic values' used by SoftIce.2 Y" x/ \" w; a' _3 M% F3 H
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 Y2 p3 A$ g" `3 Q8 E: q1 k* t" m( B, b8 X$ Z; y6 w7 }
Here is one example from the file "Haspinst.exe" which is the dongle HASP1 C! O9 N; W( W1 F
Envelope utility use to protect DOS applications:
) ]' I. J5 {$ l5 x5 u# Q; M$ p; J5 i* Q1 ?- E* z/ s% [
' Q) b- l0 b) b; w# d: @
4C19:0095   MOV    AX,0911  ; execute command.1 r" g5 C& c6 ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ j7 q, }6 q* l3 Q. H
4C19:009A   MOV    SI,4647  ; 1st magic value.# A* j9 |% w* n2 i# d* `8 R
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 U5 _" x+ i: v9 e/ p2 \! F* T
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% b' a+ I/ |; |0 [+ u4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% P# r+ s+ d9 L2 u& I( X# R0 @
4C19:00A4   INC    CX$ [/ h2 A8 {2 v, A1 o% p4 [/ o
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 s- r; K9 K! k9 x( F" w, R4C19:00A8   JB     0095     ; 6 different commands.# w$ k3 N/ o: q& B4 @; K8 R; J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 o/ v1 ]& F) J9 {2 s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( M; X& `8 [& g& M) W; ?% a6 F; U' q
! G3 {  s5 N( a6 e+ o' B5 eThe program will execute 6 different SIce commands located at ds:dx, which
3 N/ F& E; e8 ]are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ L$ B- [) V; q$ f! e+ z
* S" X4 n* w! j# l* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
* m# ]! b8 O& ~___________________________________________________________________________' l* Q: T; V: H1 ]
  ?' l7 L' s  o/ _0 i) |' z2 E2 ]; s
! m- N* z$ M% J5 n& |
Method 03$ |7 a) Q! J) }; }2 C, @- V
=========0 p! g% C$ O. p
* O5 n  e% z7 I6 a& L7 b
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& R. j6 k! _2 ?4 ?' n* J2 Y
(API Get entry point)
) N8 f) z* t* U; i: y# \/ A        - k2 k( ^; f- }
8 |' t  S2 {: E* A- d7 e
    xor     di,di3 T! K8 _; g6 j" r+ y- g
    mov     es,di' A4 ]% }* T8 m) v. @
    mov     ax, 1684h       $ p% `3 L  [* w/ ^) ^* \; \8 J% z$ F( X
    mov     bx, 0202h       ; VxD ID of winice
( m7 V: q: s1 G6 o0 j    int     2Fh
: V' f* q& g% h* M/ i5 m5 x    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) J' p; c$ F, P* s+ N8 }    add     ax, di: I! }5 W* o, K
    test    ax,ax
* m8 \# p! e' z7 L# Q    jnz     SoftICE_Detected$ g8 m5 m" k8 {4 I
1 Z0 ~' {; U  N. U8 R$ X
___________________________________________________________________________% [1 _" ?" @! z6 r

, J1 A1 n; L, @6 J' Z4 |% {  gMethod 04
0 g7 ^5 _( C9 b=========! l' j7 U* M: G  K5 ]) t
- x( g) l6 R- r1 l$ a) o/ l  \9 R
Method identical to the preceding one except that it seeks the ID of SoftICE
8 C( y/ ?- m* y' u2 W3 d% e* k; CGFX VxD.
6 t; v+ S2 H( V  P
2 b5 }" y2 X& K9 w1 T* \    xor     di,di* B% j, A/ v* n$ N6 s
    mov     es,di+ t6 X, J% F8 o
    mov     ax, 1684h       " o5 B$ O5 Z( p. D# K  i/ R
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 M. D( E4 t8 J8 f
    int     2fh  W9 G6 m2 l# b3 E1 O& M4 H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) r. N- F2 h3 R- q- g
    add     ax, di
' o) ?- z9 j! }; n    test    ax,ax( a  p" ]+ D8 N) s1 Z5 I6 [; z. M
    jnz     SoftICE_Detected
' @& h" e) }3 D. M7 Q0 J. {# L6 N. }6 _, v# B/ L2 D
__________________________________________________________________________
- D6 c2 D- e" [: Q: g9 H; |2 y- X1 S8 A& N! u/ l. |: h; u

& q/ p; X4 H$ DMethod 05. {/ `  Z! @9 B, G+ V! U
=========
& B- Y; n+ C# K! c% F7 @' m/ q1 T' _
Method seeking the 'magic number' 0F386h returned (in ax) by all system1 N( @0 |" k$ M) b! `, F/ Z
debugger. It calls the int 41h, function 4Fh.; I- L! k  L- b* T* a
There are several alternatives.  
* d4 W% t" W/ @. j: Y1 P( ?  Y7 q% q! c; F- t* n2 a4 s% q
The following one is the simplest:
) A1 r- h3 q4 \" X% E$ I" N) v/ l0 |* P4 c5 H
    mov     ax,4fh4 `0 U0 S7 }2 L$ g3 @
    int     41h
; x9 t9 M8 s4 d! r- L2 [5 w    cmp     ax, 0F386
8 b  A% d  |- ?6 x9 ]7 K$ y    jz      SoftICE_detected
$ ^8 B. }* P8 I
  |( f. R3 t$ k$ h0 B& ?# N3 c5 R1 j
Next method as well as the following one are 2 examples from Stone's
) u; {$ W: R( V9 K6 k4 ^* _$ o"stn-wid.zip" (www.cracking.net):$ @/ m, w; [( X5 [5 H% A1 \) C

9 u  V5 v9 X; X" q5 x: `1 G) e    mov     bx, cs5 l9 }1 e$ y+ w/ L) F5 `) S
    lea     dx, int41handler2
% r* `7 u5 J  `% Q  M1 K    xchg    dx, es:[41h*4]
3 B/ o; h# b. I2 K1 g. l, N5 g& A    xchg    bx, es:[41h*4+2]
: R' O4 d% @8 c, ^! V0 K    mov     ax,4fh
* B% v, i8 D' f+ U, }& g    int     41h# j3 A3 `' Z5 N) T0 P
    xchg    dx, es:[41h*4]
* ~' {% X5 c6 G: O1 j9 U' }    xchg    bx, es:[41h*4+2]
" N% J( L7 S& g8 v6 ?, T    cmp     ax, 0f386h
9 Q/ s$ [+ p' a/ Z    jz      SoftICE_detected
, K2 F$ @3 J: C6 G$ U( F" Y
9 E# J" \& @" e* M5 r) S* a: d& Gint41handler2 PROC
; s: Z# M  s! {$ Y9 D% K    iret9 H# Y: m+ S6 O1 S- K" O; n
int41handler2 ENDP
, a) O$ Z/ @/ @/ \4 m0 J4 G) a
' b$ V6 S7 Z2 n: V" n: Y: Q6 ?% O6 o, o( T8 ]$ B$ ]
_________________________________________________________________________, P/ e  J! D/ a% o: z

; C& B  ?4 Z) X, s
* f$ M, Z% V, [3 l' qMethod 06
* ]) |& b; D8 s( _* E" c=========
6 O: _0 f# I( v( J; Z: c4 i' x2 E# j
+ D1 G1 p/ j# W; S8 d+ o6 R7 k; w# a+ E3 a% o
2nd method similar to the preceding one but more difficult to detect:
: e$ |" |. }6 H; h. {' _5 [
6 T9 ~0 u; S$ M  i6 |" i: P, R0 R! y: I1 K4 }
int41handler PROC
, S, c- N4 [: v# \: i6 m    mov     cl,al
& B9 N$ ?# k6 I% I* G0 ~    iret( z) _2 V; r, e! W: X0 y* ^
int41handler ENDP
. n' M1 i0 ?, N2 }3 c, {8 C7 ?$ S+ I+ {  j- r- }

; ~& s2 M% u, I5 }7 o4 ]    xor     ax,ax
3 s$ l' B, n. z8 m0 N    mov     es,ax& T+ F$ y' a$ [' i( o. D& o6 C
    mov     bx, cs* @9 h5 ~2 J! T* D& U2 n: O3 `
    lea     dx, int41handler
5 k3 E1 V; j* K/ Z/ K    xchg    dx, es:[41h*4]
! O7 T0 K3 M% d    xchg    bx, es:[41h*4+2]
/ F, e7 p! ~  w    in      al, 40h
8 a+ Q" }/ `9 p    xor     cx,cx2 P, X( _  G  c- e% M5 z. \# p, y7 e0 I9 {
    int     41h
& B; T& G/ @0 y& `    xchg    dx, es:[41h*4]
; G; _& p( f' M    xchg    bx, es:[41h*4+2]
0 e0 j' \( h/ q; j% Z, F" \    cmp     cl,al8 }) ~- q' h+ d: ?
    jnz     SoftICE_detected
; d7 {8 `4 i2 b, _2 j/ @
: m1 c1 x2 a. l0 E1 Y3 Y( U_________________________________________________________________________4 M' z$ D# G8 ^* S
+ Y3 y! G6 z; x* F
Method 07
& p" S; w; c! z" Q: G% _' }! v7 a=========
( @9 ~) l! v  v0 ]5 r8 M5 P  @8 `1 M0 v, q/ K; N0 q
Method of detection of the WinICE handler in the int68h (V86)) |, x5 [4 u6 C- S) t! `# X) f
8 W3 V7 |' D6 L, I
    mov     ah,43h9 q( A+ }. u( Z+ Q
    int     68h
; b5 o% n: @! k2 }    cmp     ax,0F386h
% {: L6 M7 _4 _: S) M    jz      SoftICE_Detected
9 T! O1 J  k. ^' p- K! D- v: K! Y) [4 l3 c4 g' N4 P  J
9 K+ z4 e2 i6 w/ _' ~2 J: D
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) |" O$ U/ |% Z  W! x: E3 [
   app like this:7 `+ ^! C  c) R
7 h9 h0 v" ?  s
   BPX exec_int if ax==68$ C2 U/ Y9 Y# K) [
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ C  \3 ?) W: }* B   located at [ebp+48h] for 32Bit apps)
0 f. N* ?) |! V% Q__________________________________________________________________________
9 ~* ^5 e3 g- n7 e+ |1 o; {- i# }0 u# ]

* ?% F, e  \/ XMethod 08& @( E: N& [) X+ o, i
=========! N9 G, T, E" @& ^4 l5 D( m. Q# S
, R. U% {  i0 b) h
It is not a method of detection of SoftICE but a possibility to crash the
& j  [1 M3 b* z- s  Psystem by intercepting int 01h and int 03h and redirecting them to another
$ l' f3 r* c+ H: k: q- A. nroutine.
0 s$ r3 E8 J# qIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
) S+ I  S% m  wto the new routine to execute (hangs computer...)6 l5 F9 n( u3 V
- j5 O/ R: i& R
    mov     ah, 25h- d' _2 J2 t; Y1 D0 f% q
    mov     al, Int_Number (01h or 03h)8 T3 i9 \1 \7 h. f: q% [
    mov     dx, offset New_Int_Routine. W5 R' @4 ?# L2 `, I3 F
    int     21h
6 E1 m1 V2 g: v8 y9 D4 d4 m( T1 m  _2 g6 t
__________________________________________________________________________
* q8 C1 |8 X+ O  D* t3 `
7 D! Y6 X% O' m0 \7 n, D9 yMethod 098 [1 o: ~( [1 h% z, A
=========; p' H5 d- M  A! a9 w% F9 S4 }

: }) A7 ?9 J  Y! ]2 f: A3 v: qThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 N, E( U' @0 Y+ @, {performed in ring0 (VxD or a ring3 app using the VxdCall).
4 k; O! k( c4 OThe Get_DDB service is used to determine whether or not a VxD is installed6 O) h3 x6 F+ V; k+ e6 p, d
for the specified device and returns a Device Description Block (in ecx) for
8 ^- k2 W! N& N, m7 H; wthat device if it is installed.
) i& h5 z3 u5 l. M  b, F; N
7 k/ h( g) n' U4 J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 e/ Q! c9 B; u) g# p# m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 f' Q( X% m# Q! W( L9 ?- O
   VMMCall Get_DDB6 C, H4 u1 b6 k
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; k+ Y7 J+ y3 ^% p/ E
! f2 A/ u% d, l* c% q" rNote as well that you can easily detect this method with SoftICE:! ~/ C3 M+ q. X0 J" {& [. K1 o% Y
   bpx Get_DDB if ax==0202 || ax==7a5fh
# \% @7 G, F0 D1 K3 m/ \9 S- b4 `+ o7 M( E4 x4 o+ `+ B
__________________________________________________________________________  G& G( |5 K/ U  r$ c; L. W! Q+ j
( S' ?; Q( W  V# [4 |# R! V* B
Method 109 K+ K% i! F  T- X4 Q' S$ X# T
=========. H1 L+ o- o: s/ I7 D/ h, v

; C! X) o4 K9 t: X7 Y; m* w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 f% v1 g! n) y1 P0 n
  SoftICE while the option is enable!!4 Q* Q' _, ?+ o. O# Z
1 F3 w  h& o, @, _" o9 W
This trick is very efficient:
; p0 A( A* r8 [# @  z4 pby checking the Debug Registers, you can detect if SoftICE is loaded2 A4 D+ u: r# w$ e2 Q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 N( Z2 c/ }9 \- C! Y% J
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 O: S( l0 A& W$ ~value (in ring0 only). Values can be manipulated and or changed as well$ V& S! v% ~. d) Q) L
(clearing BPMs for instance)
7 w) r- M2 Y! \) c" W, f( H2 K+ ?" R
! Z$ l; B. K0 s! t( Z. }__________________________________________________________________________: D# w! s2 L. S8 \2 S
8 B3 Q0 ]  m- ?0 u
Method 11
1 s0 L! o1 w* ^0 X; N4 e=========  \  l* s% m) f
; }2 F% l% X) ]6 |# o5 Q
This method is most known as 'MeltICE' because it has been freely distributed
* ~5 Z( r( f1 Z7 W5 y  }% w8 Lvia www.winfiles.com. However it was first used by NuMega people to allow0 B0 j$ l. h0 K7 [; D& ]' `$ o
Symbol Loader to check if SoftICE was active or not (the code is located  ^; k' z* q) C/ |$ M
inside nmtrans.dll).
" }$ J  v/ E4 Y$ G/ N  t8 g% j( `% x3 x1 M  x2 s2 F$ B
The way it works is very simple:
! }. l$ s  D/ F8 j* {0 V7 _& cIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 _9 c" G0 ]3 m% f8 U2 y
WinNT) with the CreateFileA API.# r% M5 Z2 x8 N- l! G1 n
2 }: K, ]: p+ U( j7 V
Here is a sample (checking for 'SICE'):
: e6 S7 r8 t. t: L+ G; o
0 A3 e9 |. H8 v- ~# b! u7 pBOOL IsSoftIce95Loaded()6 |0 y' t! w; Z2 A0 M. F
{
( M3 q: A- J* T& a   HANDLE hFile;  
6 l: ]. m. N; R9 P& h   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 e1 S2 F, Q2 N9 [- f1 P- F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ O# [" i; Q' Z! v" o5 U6 W
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ V$ \1 g( A0 V( \& }  F9 T   if( hFile != INVALID_HANDLE_VALUE )  N) {5 w' d& t% r! I: z
   {
8 e/ X' A/ E$ |8 |9 Z  R" W3 {      CloseHandle(hFile);  D$ C& h2 L& h( T) t
      return TRUE;
7 A: o2 @- \1 ?) l+ C3 J1 G   }, L+ R, T# s  ?6 e# L" I8 A' Y
   return FALSE;
, P3 a* F  v1 M' e% m; I8 `}
+ f! D) w+ [, b. `8 y3 K; d9 ^& |- \# C) u4 t, l) ~: ^1 i
Although this trick calls the CreateFileA function, don't even expect to be  }8 R5 t4 k8 G7 g
able to intercept it by installing a IFS hook: it will not work, no way!
% P( Y! M5 K) j/ L1 v4 A) ^' p5 N$ MIn fact, after the call to CreateFileA it will get through VWIN32 0x001F3 i, O5 b# \& N$ M' Z
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( m# ?: U. }! Y5 A  i* \2 |- b' p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- d& X+ S1 Y' q. Ofield.
3 Y# N, n! H* Q+ @6 }+ eIn fact, its purpose is not to load/unload VxDs but only to send a
( M- G1 x8 z0 T$ ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 [8 {" O7 w8 U9 |$ @+ Y
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% P/ {2 _/ a. p- [/ j1 |# yto load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 o) U. O) Q% Q9 E' ~If the VxD is loaded, it will always clear eax and the Carry flag to allow
2 ~# [. _* D& G* Cits handle to be opened and then, will be detected.
9 R4 W8 ~) l3 w" \  v  E% {. L( S4 \You can check that simply by hooking Winice.exe control proc entry point
/ j9 \: l% R9 I2 C6 p; H; B3 |while running MeltICE.
1 n) D) O  f. s! q
. }' K' D0 O5 y, M4 E
0 D! V! j' j, s2 z: X  00401067:  push      00402025    ; \\.\SICE
/ D8 p9 K7 e! G  0040106C:  call      CreateFileA
. N: [6 Y( R2 E' P( s  00401071:  cmp       eax,-0015 }$ P2 m; j  ^! Y, c% ]6 P
  00401074:  je        00401091( ?5 W5 i; M' Y- C* W

) f, |/ z3 Y3 N+ A# C% N2 V0 }
4 _5 u$ X2 ]1 o4 v- N1 nThere could be hundreds of BPX you could use to detect this trick.
# N; E7 ~  i2 [' [/ i-The most classical one is:. n+ J5 v( }  o1 D' r9 V; Y4 U* s4 e" P
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
3 J- q0 n& \  v5 t. N3 O    *(esp-&gt;4+4)=='NTIC'3 C3 Y3 W* B9 W* W
% X" s" H: ^! [2 X
-The most exotic ones (could be very slooooow :-(: ]3 D$ \3 A2 b! |* |; J
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 c: r; }5 i1 \4 b: [     ;will break 3 times :-(
! `: d9 C5 X7 V' t, a. C0 }/ C- A6 m! w2 u; V' V. G2 d
-or (a bit) faster:
) n0 W8 w& o& E4 ^9 P! A   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# ?& R$ _: {  z8 F3 u
, v. d) r) n# z* k7 j5 e   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 z: S* q0 h4 {9 C8 }7 i
     ;will break 3 times :-(
" B7 M, X' x' N- X6 p
4 s) P$ ?# ]3 `8 _8 b3 u-Much faster:
( f8 }* p9 `7 d" J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'8 ?$ v6 {, F8 P) V7 P& R( ]# }
3 I3 t1 f0 d. r/ w( w; |0 J$ V8 P; l
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 m; ?" P" ^; p# v) Rfunction to do the same job:: h) X8 O, y) ~# B5 v# R

' U8 {6 B1 _: g( B   push    00                        ; OF_READ
* d5 U, W0 V& E" w! u( k& i   mov     eax,[00656634]            ; '\\.\SICE',0
& T, K: l2 f* Q! h" q8 Y   push    eax
9 y& U. T9 q' i. D, F4 M2 i' @   call    KERNEL32!_lopen2 b; U* n8 l! F: F- l
   inc     eax
4 J& s- D' x6 w5 p   jnz     00650589                  ; detected
% D! [- e* d+ {/ x- d+ A   push    00                        ; OF_READ
' p- I" O& T, @6 S$ l6 j   mov     eax,[00656638]            ; '\\.\SICE'
% y# s2 H/ z3 b( g- q8 [, x   push    eax, Y0 x/ x3 O5 P
   call    KERNEL32!_lopen- G$ Y' m: }2 S; \
   inc     eax
9 @! d* b6 O$ J! K   jz      006505ae                  ; not detected
; T/ }0 W# v" z3 `& e3 Q
8 I. S1 ?; F; G$ b8 D) [/ k- z5 g- L, g8 U, o& Q5 j  o- ]
__________________________________________________________________________* v1 t# H% ?3 K+ W0 a$ K; w
6 c, {5 Y, H& v  u  ?
Method 12) x+ }. x" S' b- o' M- j6 N# s7 w
=========
. ~9 F; I: a+ D: F  l8 p/ J5 l. ?
- H8 K+ A1 Q( T% t& P; B" f8 ?This trick is similar to int41h/4fh Debugger installation check (code 05$ t! A6 X9 {9 O* H& D
&amp; 06) but very limited because it's only available for Win95/98 (not NT)( g$ R3 Y7 E7 W: D
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: D- `6 L& h4 o3 l1 Q, j
) [+ u' `6 a3 s# C   push  0000004fh         ; function 4fh" O# Z# {$ N- U) \' A
   push  002a002ah         ; high word specifies which VxD (VWIN32)
/ Q" f( S. e' D3 ]0 Y( I0 z8 ~                           ; low word specifies which service% b' k3 C) ?) ^; H3 I( a# K$ b4 f8 v' P
                             (VWIN32_Int41Dispatch)3 l5 H2 i( D! ^  B
   call  Kernel32!ORD_001  ; VxdCall. h. h  |- i% c4 r8 p. D! A
   cmp   ax, 0f386h        ; magic number returned by system debuggers
  ?$ I: w8 G& v& M   jz    SoftICE_detected
! d& R$ c/ b6 @: ]/ F: [1 Z  V, W2 `3 z
Here again, several ways to detect it:. z3 |, r0 C8 i
2 i+ @, u) Y& U. n, Q. ?; I
    BPINT 41 if ax==4f1 g6 V6 \1 {3 O3 J( K% F. F9 W4 ]/ k

9 W) E1 U  }  }/ g- n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 v  p2 h  ^' j0 m

4 u0 h( t# y+ e. p5 Y$ T0 ]) S3 Z    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 |2 a3 l* @7 {. W1 z' c* A; ]( \, R0 r! n
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. o& e+ ^" V! G3 Z
7 r8 o9 F& I0 O0 X6 A3 m1 `" \__________________________________________________________________________: Y' I! [5 R: M) d0 L$ o8 l
0 A1 t* w8 m2 M7 B( e
Method 13# G1 A% B* i; z1 g' E
=========5 L% O' t( K5 X; f- B( N6 d
+ B# C# Z0 |! g
Not a real method of detection, but a good way to know if SoftICE is
, s5 G, o" c# X, ninstalled on a computer and to locate its installation directory.+ D7 w, @' y* d9 Y
It is used by few softs which access the following registry keys (usually #2) :6 Q* Q7 C$ r' B# o# l
( m7 `4 B  y, N2 A: z. g5 ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, L0 m) S% c5 `0 d1 }\Uninstall\SoftICE
. P. G# c$ H$ o- a-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE9 P6 J8 r* j7 M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 _6 u/ G, ?/ S
\App Paths\Loader32.Exe) I+ _) l' S& K: W
5 ?( d' D4 s9 L: X. N/ P

' f- E3 s: S) MNote that some nasty apps could then erase all files from SoftICE directory
: b7 f% X+ G; ~; f( ?0 \(I faced that once :-(
# w0 r9 W2 C- l0 J! k7 V! S! S! q2 U
Useful breakpoint to detect it:" M( S1 W( N3 G6 I3 d* Z- m; o8 G
! Q- a, R, `! E9 E6 H
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, B9 s, q$ {, B  g2 {" u, H( B- `+ W' v/ c- v5 A1 ]7 f% n3 {% D
__________________________________________________________________________
" t1 F. _, \: e1 N- y7 J% ~& N  I  k6 U

! I/ K( Y( L: R" w' r6 I# @Method 14
+ G# o( I1 }& u  h  C=========
% ~- H6 ^. y/ C" e! s/ x" F* D+ L: W! ~% A
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose4 p6 o' C8 n; Y
is to determines whether a debugger is running on your system (ring0 only)./ d: O$ i6 R- @8 i/ L2 e
$ N2 _0 ^# _! d2 ^/ `' K
   VMMCall Test_Debug_Installed; w1 c5 s9 A3 c, x2 u
   je      not_installed( V  ]9 B6 |' @2 H' w
8 v% Q5 O6 K3 q' ]4 s& I
This service just checks a flag.
1 J! w9 q( @1 ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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