About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% B5 K  L6 p, I6 v- J; K2 H<TBODY>
8 X& m& E6 P& R7 B+ C<TR>
/ l: G8 ]; h' V# \2 r<TD><PRE>Method 01 ' a% X# e. Z  @* p- ^
=========
- u! T  t1 R6 g1 ^+ K% U+ M: z' @9 P9 v! s2 ~( ^
This method of detection of SoftICE (as well as the following one) is6 h" u. d& s- r! v3 q, \
used by the majority of packers/encryptors found on Internet.
9 D8 |" Q; s% _. J7 ?5 r$ JIt seeks the signature of BoundsChecker in SoftICE
3 M4 \# E6 r% |
3 v) I5 a% p5 w7 U; A) p    mov     ebp, 04243484Bh        ; 'BCHK'
6 `- m( T# Z* u* t2 {' l    mov     ax, 04h7 I3 e( v. E& Q! R- f$ e
    int     3      
. k0 o$ z8 \0 y# H& r    cmp     al,4
& h" W* B1 W2 ?/ e: K    jnz     SoftICE_Detected
2 @5 }) b' W8 {3 c; J- D* Q3 {! P) J; v) B, A9 H
___________________________________________________________________________( K1 n4 E' K: T( L! B
. U0 ]# v1 L3 K" O. J& Q
Method 02
0 |) o: j, Y& h=========9 m3 Y- ]/ x8 I( V2 |0 ~3 C
- J/ W* F  i3 x9 f3 k+ _! R
Still a method very much used (perhaps the most frequent one).  It is used4 }% m' `: g0 o, A( L8 F1 v6 E! h
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
. U, I2 }4 ^- Bor execute SoftICE commands...
4 i: n9 ^& N0 }% w# K! @; ^, DIt is also used to crash SoftICE and to force it to execute any commands
8 v/ g0 r6 A6 k. I(HBOOT...) :-((  $ C- U: e4 k# o& |$ w; }& i# [( G

6 L  x. M2 \& _; {) }# cHere is a quick description:
/ T- U% ]1 O2 J3 U6 j& L-AX = 0910h   (Display string in SIce windows)$ A+ Q* ^: h! p$ S: a
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)! e- D8 L& R8 G4 E
-AX = 0912h   (Get breakpoint infos); e) w: n0 h5 d* {/ ?$ x9 b
-AX = 0913h   (Set Sice breakpoints)
+ U/ j" c+ O2 G0 p4 S( v-AX = 0914h   (Remove SIce breakoints)3 g8 q/ E. i  }: e
. Y% \9 r& F  }5 z# }9 \
Each time you'll meet this trick, you'll see:1 F0 z8 r# c# ~" ~5 W/ {
-SI = 4647h) r$ g' u' A. ]
-DI = 4A4Dh' B* C9 T2 T: l. P& L: _- f
Which are the 'magic values' used by SoftIce.$ W% |  i1 R7 |! o" Y, T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.& x0 q( ^# g& T' ^1 r0 z# e9 h
% a, b* d* O# g* _  A- g
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, R4 w: P! @* f) w0 \0 \6 pEnvelope utility use to protect DOS applications:
. y" T/ u" j9 s6 P, F- r) ]8 @3 C; u* W: b+ z7 |2 C, P+ e' I. n# r

$ _. \) ~2 @. B4C19:0095   MOV    AX,0911  ; execute command.3 f* B5 c; e& w+ i: n+ n- @1 z$ Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  u9 B$ k! q: q5 Z- {
4C19:009A   MOV    SI,4647  ; 1st magic value.$ c% c7 u/ J2 L: ~
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- S6 d8 V8 i; a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" ?  @1 [1 Z9 X5 P+ O
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" ]; G+ _* \5 x& u+ L2 ]
4C19:00A4   INC    CX) i1 D  S( l5 {) ]. g* I$ e( f8 n
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- @9 ~! t* z+ v; B% ^
4C19:00A8   JB     0095     ; 6 different commands.$ N) l- \2 h" i
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
% i6 b" T# y; l9 `3 U) }& P3 e8 o4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 O" n! |. Y$ ^2 L/ s5 u
  R) x! V5 z; H4 s( ~6 z7 @0 K
The program will execute 6 different SIce commands located at ds:dx, which5 ]2 H, m7 |8 C; n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, W5 l$ }; v7 U. {9 I  G
8 }; e/ w  T# Q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ `7 S3 X+ h; m9 q___________________________________________________________________________3 r0 o4 X+ {2 P4 @4 S9 n0 M$ y4 E  e
% h1 c! J  z: Q5 d. i& B) {
3 x3 z( N/ I1 P) t% }% X
Method 03
' f6 Q: I5 S# I6 i  y) i=========
. `1 @( V  s0 W  K% I' y3 d4 B. ?8 n7 W1 P& [' j$ X
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h0 L4 C2 A9 p3 D( p
(API Get entry point)
. x  h/ j% c! ?; K% A, ~        
0 ]! [; Z* Y4 u0 Z6 F/ c8 y
! q8 W7 i' N6 k* h% [, y" n$ ]- S    xor     di,di' @5 {0 J2 k0 V8 E8 C  N1 u
    mov     es,di4 o5 m2 N) T( Q5 D3 h
    mov     ax, 1684h      
5 w( v# w9 j" h6 U1 U& F    mov     bx, 0202h       ; VxD ID of winice
5 u" x/ N6 j' l7 N7 w! p    int     2Fh
7 R# w0 @6 w; c+ }$ U! w4 j( G6 H! Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 j. Q+ U, Q' @$ h& m7 [0 }    add     ax, di2 ~3 e2 M7 }3 f# R+ c! X6 p; J
    test    ax,ax& a4 j* Y2 Z. {/ ]
    jnz     SoftICE_Detected4 R& C3 P$ H3 E* O- h
# M+ o  U! S; g8 ]+ P0 j
___________________________________________________________________________# `& i5 J  B7 l: v0 j# Z1 u" I- Z
3 s+ w1 s! G; C  T8 @! Y" p
Method 045 ]. l/ t+ b' I4 C7 z- n
=========9 F; X: L: x- |& }' E) `; n

1 e6 o- z( K8 j' o7 [0 UMethod identical to the preceding one except that it seeks the ID of SoftICE& F) r& x* }3 k. D8 s* Z- d
GFX VxD.
' Z# u1 q' ^/ N' o& L7 V8 Z. w7 A1 N, I9 R) i
    xor     di,di
' E- Y& j& ~- s1 I; G9 }7 L- \    mov     es,di
3 d2 K* S7 F; A+ k    mov     ax, 1684h       % u% D0 b! F5 w7 A0 i
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 ]3 l, {2 Q2 }1 X    int     2fh
: M( H. n4 X; y2 h    mov     ax, es          ; ES:DI -&gt; VxD API entry point! L/ J$ j! L7 Y+ B9 W6 Z9 A2 L( [" ]
    add     ax, di
1 A0 g  h7 }* c( J    test    ax,ax$ Q5 j5 {1 x* F3 E) D8 r8 v* o
    jnz     SoftICE_Detected
+ \0 n; S8 ~: W7 w3 g
6 D+ ]% N, l( ~9 c( l0 e- P__________________________________________________________________________6 ]0 K3 [4 S- J5 Q
. H; l! f4 g. [

0 O$ J" n0 k. W6 b: C9 }. X3 e2 |Method 05. W6 ?. J; k, w* Q5 v+ ]1 ?
=========; ^- U2 D+ J; }; D4 T* U7 c- b* h
% r) S) F# c2 o0 d  a
Method seeking the 'magic number' 0F386h returned (in ax) by all system2 M" L% N4 S! n  a+ h- `
debugger. It calls the int 41h, function 4Fh.
1 U2 W6 ]' w  J* j- L/ dThere are several alternatives.  * f/ x, @2 d1 M6 }6 l3 B4 N
0 g# C( C* Y+ H4 w
The following one is the simplest:6 j9 q8 @1 {: U3 d( ^
3 u6 U. ]+ u4 y1 D; w
    mov     ax,4fh
1 q$ n  x! b6 C" ]1 f    int     41h; _; i5 ~* V/ w0 _" K0 c
    cmp     ax, 0F386
/ P: X2 w3 a+ A9 Z3 h* o/ @    jz      SoftICE_detected
; r2 w- G2 B$ I5 l: r0 L: ^6 V8 p; W+ X; R6 b
- l- m( f& [; E( a# T# W
Next method as well as the following one are 2 examples from Stone's , \6 X5 d( _0 w: h; @% b& C+ }
"stn-wid.zip" (www.cracking.net):
! B: H* z- O* K8 U. ~# }( }3 x% E7 d/ A) Y! l  g5 ~$ i
    mov     bx, cs
! Z: t. O* s8 z, Z- k4 \' `    lea     dx, int41handler2- x% f$ I) k7 _1 k& l" I
    xchg    dx, es:[41h*4]
6 r7 b4 }4 [8 z  Z  n    xchg    bx, es:[41h*4+2]
2 T- n* W3 f7 O    mov     ax,4fh
$ H- ]$ n1 l  h" t+ C# T' o& O    int     41h
* s' A. i7 B2 I& W. H    xchg    dx, es:[41h*4]
9 J$ ]2 x0 O( s+ n    xchg    bx, es:[41h*4+2]! ^0 [% y) [( {$ ~3 u7 ?
    cmp     ax, 0f386h! }$ d/ G: e3 H. \
    jz      SoftICE_detected* b, Y* B0 {9 J5 ~6 D
. g. \- U& h( |0 H% B
int41handler2 PROC/ C$ c' N+ E' ~5 d
    iret
8 ~1 L& ]2 p7 x( ?( C) Z' T$ Eint41handler2 ENDP
' y1 K, V1 s# F7 c4 V) j' ~0 w8 o' }7 S2 I  e. E' Y
6 v+ C+ w. l5 M" C; m) ]8 ?
_________________________________________________________________________
3 m6 q  d1 M! F, H+ [' Z  F) y& s

2 P, M3 I0 v6 GMethod 06
4 d  z; j) E' }# V$ o=========
, n& {) W; \' t% @$ j- a- `: X; {, w; A& i
9 q# R8 g" b$ Q2 ~3 Z& w
2nd method similar to the preceding one but more difficult to detect:" ~5 g) L8 e- s- H
/ Y- B- L: |. c& w9 O
+ I( ^, S# H, [& w! B
int41handler PROC2 d" `( V& O0 ~4 g: z1 {. S; {8 x
    mov     cl,al- m4 W" P# X% u& l! f) h/ n- b( y, p
    iret
$ u) S3 [" J1 h* Dint41handler ENDP
  X9 W4 H& J- o" S" k9 ]8 b
7 V) d3 X# X! l3 T2 ^. Y; \0 b# b8 X- X* c, o
    xor     ax,ax
4 k7 d( b4 \- N4 P, u0 A/ F    mov     es,ax
3 ?2 Y& H* ?' I7 g    mov     bx, cs
& v! D# t- e* J7 q3 {) o# p# L. |    lea     dx, int41handler
: D9 g8 H  d! o. z& V. `    xchg    dx, es:[41h*4]0 U, e. X) U' I
    xchg    bx, es:[41h*4+2]# }' S& q# {8 y4 G4 Q# P
    in      al, 40h, h+ e! v' P! `5 l
    xor     cx,cx
! H) J; U5 Q0 a# s& V4 k    int     41h( u) ]- d& D& R+ L% g4 t7 n/ `6 q
    xchg    dx, es:[41h*4]
) }0 K' S4 N" n  E" F    xchg    bx, es:[41h*4+2]
) Y1 {/ ?% _! o% x/ ^- C( s0 H    cmp     cl,al
- I$ ?2 `3 u5 F5 S+ C0 Q  B8 C9 ?# H    jnz     SoftICE_detected$ a1 X: r( q& }

9 X6 `( P1 U( n0 R+ u5 s_________________________________________________________________________% {3 Z+ H2 l: ^2 T" J! P

% X8 p  f) K5 b1 O" V2 kMethod 07
0 i3 F/ e' a4 v( d5 b) o=========
/ F& l" Q5 s( k$ K0 X) F1 M
. r- r4 {8 d. N$ P/ ~' i6 Q- mMethod of detection of the WinICE handler in the int68h (V86)' Y2 F, J5 \: j0 }0 ^

- D: V, F. B2 T. Z; j2 f7 O    mov     ah,43h8 N4 h  d! }( y
    int     68h3 ^3 A1 I2 H* {5 m
    cmp     ax,0F386h  {- u8 p, @4 O- |: q0 i
    jz      SoftICE_Detected( Y9 {& F# Y% S  a6 p) B

: m$ t2 B3 F3 ~$ O# ]# l9 p) d* @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 b8 F! R) e3 g# |- O: L
   app like this:
% Q0 H$ ^  _9 i: f- ?; @# n8 B* T6 W* D  N0 \" W7 \9 R
   BPX exec_int if ax==684 z; K: G7 n5 _7 r. q1 X& |7 r
   (function called is located at byte ptr [ebp+1Dh] and client eip is1 `; n. l9 i) W4 ?
   located at [ebp+48h] for 32Bit apps)
9 _3 x( e/ k, y) m& Y__________________________________________________________________________
( A" [4 R! x3 c- H0 U7 R
( H; w2 U  Q1 K  ^1 x% K
1 Z1 c9 P/ P. H9 b8 G8 `Method 08! J: k3 V. U. O6 F  {: v( ~
=========  K  u, D8 g( q

- P' x4 \0 X- U; ~6 KIt is not a method of detection of SoftICE but a possibility to crash the
% l( N& U( d. s& Y. Esystem by intercepting int 01h and int 03h and redirecting them to another
- `8 j. d" F0 |/ I9 K. E+ M% y/ B: Hroutine.
* V# j- x- \. X6 ^: j( U+ pIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 e3 F' I6 ^: M6 M, ]to the new routine to execute (hangs computer...)% D$ b" b# r4 M) K

( U0 ~+ S* Q5 g# ?    mov     ah, 25h
) h  M: L0 @. u6 @/ a    mov     al, Int_Number (01h or 03h)
4 |* o3 p( f3 Y; ?+ @5 e    mov     dx, offset New_Int_Routine
4 P4 K1 K9 I# U6 s6 F2 V    int     21h2 ^- W; A. J: f4 ^- p, W  {$ `

4 ]( `, e0 r8 S# m  G' o__________________________________________________________________________
, ]9 [; G) }( V  h) A- q
+ [2 Q+ A7 p$ u' g/ m0 k& |Method 09
: i& N6 V5 X' q4 ~6 B3 M=========) T+ o8 ~' J: }; e) Z' K

) Q+ w' m- @9 _6 s% gThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only4 ?. W5 _2 h  n( Y8 P! |$ r
performed in ring0 (VxD or a ring3 app using the VxdCall).
5 w2 N# T; Y7 WThe Get_DDB service is used to determine whether or not a VxD is installed+ Z( \9 W8 I! g
for the specified device and returns a Device Description Block (in ecx) for+ O' z" |, l, z* w
that device if it is installed.5 `. m; c4 _$ z- i1 }
8 Q3 c% ]4 f( B" H
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& x' J. k7 ^, e9 z/ s( W
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)& t* w6 N$ p9 ~8 ]; w
   VMMCall Get_DDB/ r" n/ V. y: `3 T" T  z# T  U' F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* }9 R: p$ p$ |
/ e+ I7 ]% e# M; X  BNote as well that you can easily detect this method with SoftICE:
4 q9 O) X( C( K   bpx Get_DDB if ax==0202 || ax==7a5fh
6 ]0 B6 [( S, B: Q
0 ~( C9 f6 I7 t2 o* f__________________________________________________________________________, ~4 T. x# g; A" t% q$ e9 W
3 x- L8 h! Y( z3 U+ i* a8 r. ]
Method 10
+ v0 s* M5 r) U  [=========6 z$ ^; q/ Y/ C& Q
& m/ @. X, }" `$ [8 Y: S3 j
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 F# I; Z- i2 z. H6 s) w. g8 ]
  SoftICE while the option is enable!!, i! {$ |8 p0 |. K+ x8 M
9 k3 E! F, G) }7 v8 n$ c
This trick is very efficient:& E2 D' z! Z0 Z0 }# |' |
by checking the Debug Registers, you can detect if SoftICE is loaded
* s* g* I' l. t% P(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if! H. y* k- Z5 F, z+ `: j. l  b/ K
there are some memory breakpoints set (dr0 to dr3) simply by reading their
8 j6 @- D- P% m# t! T' M( G+ \% avalue (in ring0 only). Values can be manipulated and or changed as well
8 A$ D2 `: c! j% ?(clearing BPMs for instance)
7 ?8 F. x- F/ H( {- G  [
3 S* ?+ ^4 Q+ K  }/ x1 i9 m9 S__________________________________________________________________________
4 M) a1 T- h2 m# c; u4 m/ U
7 P9 E+ S+ \" c3 L. {+ y2 ]Method 11; P2 {- L1 k% G+ d' Q9 ]# Y
=========7 a. C; }2 o/ ~% p* ^: V/ P

0 C1 E3 d7 p) N  `This method is most known as 'MeltICE' because it has been freely distributed( Y2 d8 A8 F1 P5 w- ]; o
via www.winfiles.com. However it was first used by NuMega people to allow
3 A4 R6 [4 y" F. U+ s; j, \9 SSymbol Loader to check if SoftICE was active or not (the code is located
9 A' X* L0 A) d8 i1 }inside nmtrans.dll).; P3 B  _+ V" F1 {* U" S! O
- b0 a3 n& [% U+ H- o
The way it works is very simple:
- M0 O2 ?8 Q+ |2 h! ]+ ]. [It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- U) }0 @, Z% K) z5 [5 N( Y( pWinNT) with the CreateFileA API.
8 I# }) K! n8 J/ Z! ]! k- k( H* u. o$ r
Here is a sample (checking for 'SICE'):
' V7 }) w# q6 I' Z* g
5 l, v, K" E1 P# o, U( z3 yBOOL IsSoftIce95Loaded(): `% N' `" q; [9 b1 ^4 L6 T. N
{& A# w+ C' [$ r( X
   HANDLE hFile;  
* u3 \. x% [) Y- |( ~   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,2 n2 f5 d6 [% l! X
                      FILE_SHARE_READ | FILE_SHARE_WRITE,7 m/ ?  }; e0 w  u7 R5 l
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);( _+ H. H  ^& V6 x7 ]6 E
   if( hFile != INVALID_HANDLE_VALUE ); B* K* _, i. H( k* N. N
   {+ @% N1 _5 s& ]8 U, e6 f
      CloseHandle(hFile);
- |. S/ L+ f1 I      return TRUE;8 {1 y& U& g( D) g# T. \
   }
0 T" Q4 t4 E- r- g   return FALSE;& C. W6 T: I- c+ S1 T; }
}! N3 Q7 Y/ e- w& @/ p* g

$ l! a* X* z* M3 }6 rAlthough this trick calls the CreateFileA function, don't even expect to be
: z/ v# a: e! A# Z/ V, A# Y7 Dable to intercept it by installing a IFS hook: it will not work, no way!
9 E" y# ^9 D- ^9 K6 RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F2 Z/ d  K# i3 L! i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ U# B4 c5 S! E1 J
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
& M0 }% |9 l; G: s3 R' `field.& M$ z2 P$ ?( I6 r7 v
In fact, its purpose is not to load/unload VxDs but only to send a . D% k+ _$ a5 Q# R6 H; A2 W6 L% ]
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 r& q# u2 Q1 ]+ L# a& N6 }
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
% F. k7 t( X; w7 ?1 P6 rto load/unload a non-dynamically loadable driver such as SoftICE ;-).
; [5 A. [; v. G8 t0 m  N$ uIf the VxD is loaded, it will always clear eax and the Carry flag to allow
! u5 v6 \  c5 a' Mits handle to be opened and then, will be detected.
7 w/ o3 b* }1 f8 d9 ~1 AYou can check that simply by hooking Winice.exe control proc entry point2 \- _# j7 s  m, D, |5 L) Q
while running MeltICE.3 C: ^- G( ]* A, Y4 X

$ Q  x2 d+ G# r
2 ~9 x4 x! V4 P' j) ~  00401067:  push      00402025    ; \\.\SICE
4 \: T) x3 S& y' d  z8 T  0040106C:  call      CreateFileA
" p/ `5 u: A8 Z! H* C2 D7 d8 J  00401071:  cmp       eax,-001: O' t8 u  V8 S! \0 ~; G5 Z
  00401074:  je        004010911 h5 e1 D' F! [  c0 B
( r* S: h# X. t, j1 a! Z" J
# J$ a8 G9 d! s9 i" |  W
There could be hundreds of BPX you could use to detect this trick.) I; I& U$ R4 ^, n6 u
-The most classical one is:8 J- o. ~" Y: P" N/ X. }3 x! h
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" z) l& k, l' w( I% ~$ c1 t    *(esp-&gt;4+4)=='NTIC'
! I- l2 u9 H- t# ]: V" T3 f
. s! K- r& h2 I! Q, |; j-The most exotic ones (could be very slooooow :-(0 {! S1 t# N9 a7 V* F
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; M2 c' [6 @2 q7 K; ~: O
     ;will break 3 times :-(6 H" X& a$ _5 ~. X8 ~- D
& O, G0 N4 J+ r7 x
-or (a bit) faster:
- g0 a0 B5 q$ ]5 }$ O1 {) M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')' i& B+ M* W3 I0 ?

% `% H* ?! a" E7 k   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 ~7 x, q) z& @     ;will break 3 times :-(
- j1 b- X$ e" v8 ^8 f. Z+ F
8 s) @2 h- l+ w( v-Much faster:
$ Q6 F1 D% o( l! s   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'" B9 @2 Z0 A" Z+ j- R

0 r5 d6 s3 f8 XNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
# D% ?' b7 u4 ?8 `* @! s0 dfunction to do the same job:/ z2 p0 [: U4 [- i# W% R2 ^% U
6 ^* g6 G/ ]3 t" T% ~. @) ?- \
   push    00                        ; OF_READ6 d$ Z4 O* T6 I: S) ?/ S) J  Z; e
   mov     eax,[00656634]            ; '\\.\SICE',0& k/ A, g: j7 v$ p' S, ?. G
   push    eax; ]  }1 N! T2 k4 `5 T- j9 h
   call    KERNEL32!_lopen/ r5 i) j* a! [8 y7 w# u3 C. N
   inc     eax) [" b1 R3 c+ v4 f8 n
   jnz     00650589                  ; detected( J& y9 P5 v1 }* g/ t
   push    00                        ; OF_READ1 C* R" e1 D. p; I
   mov     eax,[00656638]            ; '\\.\SICE'6 a7 j; F2 e8 ~, q
   push    eax' n- s: j, {( Z( x# i4 y5 O
   call    KERNEL32!_lopen1 {. t; J- P! K& v; Q
   inc     eax" k+ ^  \2 y$ F/ W: g( E: r/ d5 K+ p
   jz      006505ae                  ; not detected) @: _4 Q2 F) T3 g
: d( t! G6 d' Q( h- |. t; u) u
# h! c4 G. L7 o% z: u  d! c
__________________________________________________________________________" ^( b1 F( _& `) A* \. U5 n0 d' g
7 `$ w1 s& O7 X0 @
Method 12
$ C3 {' W5 u  y( ^=========
+ h  p; Y5 }/ m1 e+ I0 B* ~6 H/ p# H5 Q, J+ N
This trick is similar to int41h/4fh Debugger installation check (code 05$ O" j9 J& [6 J) x* w8 y' O
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ W% `, X2 u2 p$ Y' H% _as it uses the VxDCall backdoor. This detection was found in Bleem Demo.0 s3 t8 n6 J3 @% O- ]7 s, d

" O4 |  Y" A+ u0 ?+ }+ K   push  0000004fh         ; function 4fh$ f* C0 |* D* B3 K' f3 Y/ G2 g
   push  002a002ah         ; high word specifies which VxD (VWIN32)
0 `: H' w6 L" }                           ; low word specifies which service
$ |/ ~0 b4 h/ F. i  f                             (VWIN32_Int41Dispatch)
$ N& J9 Q4 i) n8 \   call  Kernel32!ORD_001  ; VxdCall
5 u4 X3 \0 L5 c   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 A8 I0 m& L) P   jz    SoftICE_detected
# }* K* X; O. r6 l/ H" @+ \
/ G/ H5 I/ N4 t  x: \3 NHere again, several ways to detect it:. z: X' W& p+ |3 q5 L

6 d0 p, p3 v' g" R, c4 p    BPINT 41 if ax==4f/ b8 `# b8 Q6 I8 u) J$ q5 J

1 C( V9 f- C5 M2 W7 o% n( o5 z1 E    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) ?( v4 T! j. X  {2 \+ c
8 p! e! w' u' ]# w
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
/ y6 ]# v5 k$ ?- ?: Z) Z  z
+ _# N. |5 s" L    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
+ Q7 x; ~  j0 Y4 T6 u1 i  u- |: e2 n
__________________________________________________________________________
4 r: @' O$ k' W; j0 T1 j  _
' t9 e% |; U% t' s9 DMethod 13. N% ]  |! q7 o1 R$ l
=========
* U; q, E9 l+ e' Z, @
; H4 q+ C, Z* w. c: v9 vNot a real method of detection, but a good way to know if SoftICE is
/ p  ]5 T- p" ?' I$ c. Z& kinstalled on a computer and to locate its installation directory.
- j6 K9 ?0 @4 d2 p9 l; e6 WIt is used by few softs which access the following registry keys (usually #2) :" k; D8 O8 r+ K

4 S9 S; c' a' {, Q# c0 o* n-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* \1 E/ V0 t% C: l\Uninstall\SoftICE* S8 c- D$ H; T8 r; O- l6 j
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) |! [! M8 C1 B2 ~: Q) ]. T
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ M/ Y9 G' k1 l1 O; Q& D\App Paths\Loader32.Exe& @% _% [  K: S& k/ _5 U

( W7 }: R$ T( o; Z, `4 u" |  S! E4 e0 I9 s! o3 A& e5 }' {' |
Note that some nasty apps could then erase all files from SoftICE directory% n2 A9 \4 X$ l$ p. a) R! w# m
(I faced that once :-(* Z* G1 ]: L% w# c

8 ?( `; h+ I, P7 S0 C4 b1 jUseful breakpoint to detect it:
) \1 E' D/ M2 ?$ j7 j
3 t, L  e# ^7 b4 L1 c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 _( t% R/ |/ R, R6 O$ B# ^, v# A; P9 b
__________________________________________________________________________
3 S, U( w: o% W5 F: Z' c% [. C) C$ K2 D# D9 J$ F- M9 G, N

& @! [, |7 F3 T- q9 V  `, e1 MMethod 14 $ ~; ?& k9 B0 W
=========) e* s3 w" B+ h/ M" j7 P& `; f! Y
6 W* i4 n+ I8 z& J( ~) m0 p  `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( ^: F, J6 \) D% qis to determines whether a debugger is running on your system (ring0 only).
; O' M* z8 w/ B2 S2 C! ]
9 j7 t+ F% o* Q0 n! \# H) p% M   VMMCall Test_Debug_Installed
7 h7 p1 x! \* y/ X$ I# D+ q   je      not_installed
! Q* `' U7 x/ ^+ c0 r3 @  I$ ]/ {6 d1 Q: Z: e
This service just checks a flag.
+ y. F  u' p" X& R( E- F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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