About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, P: V+ }5 Q% g1 ^$ W<TBODY>, ]# b! [* I3 U! q1 h% r
<TR>. V! M/ r7 D! P1 K4 m( o' U
<TD><PRE>Method 01
6 Q$ l' `& \7 E=========0 C# q5 {* k7 e# M9 R1 R+ L* D9 L2 {
" c" w0 ]8 l5 a) x3 {4 \! a
This method of detection of SoftICE (as well as the following one) is
# N6 ?9 j: ?! v2 a! Y5 u/ c1 Zused by the majority of packers/encryptors found on Internet.
2 l; L: l! z9 z$ q% JIt seeks the signature of BoundsChecker in SoftICE
: F; R2 L! x* X: L) b+ N! C5 d3 X
0 L/ N5 b2 G0 q3 \1 I7 J4 y    mov     ebp, 04243484Bh        ; 'BCHK'
; I$ h# \8 j: S& O" S/ R2 Z    mov     ax, 04h
2 C' b3 Q4 \7 Q8 N# d0 U    int     3       4 S, D( E% a" s3 w3 a3 E- k
    cmp     al,4
+ q9 {5 N' ^$ l! t    jnz     SoftICE_Detected/ S3 P8 J& R1 p3 L

& B, z) L8 E* s3 [  ]5 q0 W___________________________________________________________________________7 ~, R* W9 n( {* T
0 b9 x% t  |/ j5 j) |4 S; R
Method 023 L  D$ Z8 H/ q" w3 }
=========& F  x- d6 A9 X$ G/ R  j( X4 b4 U

3 D8 \" l+ X$ J  P, {Still a method very much used (perhaps the most frequent one).  It is used0 u4 Y2 [9 N4 p' u7 \
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* ]: K! k* Z* F2 x* N/ gor execute SoftICE commands...
' M. T9 @: o% [6 G+ N+ G* u. qIt is also used to crash SoftICE and to force it to execute any commands6 L0 c. `* V+ o  D8 f/ z, r- O9 c
(HBOOT...) :-((    W  V7 y3 f: c

2 h/ U3 I# i3 g% `, MHere is a quick description:" s( B  k0 G' b$ E! `
-AX = 0910h   (Display string in SIce windows)0 X- G9 f8 y9 w9 y/ t1 P  G2 L. g
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)% I; M6 [* m+ u8 A/ S7 u
-AX = 0912h   (Get breakpoint infos). P2 _/ l  i/ X) ~# w" `
-AX = 0913h   (Set Sice breakpoints)
! v9 X4 s$ o' V* e  Z-AX = 0914h   (Remove SIce breakoints)/ S5 G' f7 g+ h0 l  x- O3 _( i

8 \4 ]# j& x6 E: R( t; IEach time you'll meet this trick, you'll see:
* c# D1 e" {; M, c& a0 W- m-SI = 4647h
. c% Q% c) K  Z: b9 \2 J-DI = 4A4Dh
7 C" `% K3 }, z/ U$ gWhich are the 'magic values' used by SoftIce./ Y4 B$ C, D, k" i  C7 ]
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% @/ |3 X- o1 N: S+ c
3 t1 O. L. v; M: B
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 `1 W5 X$ D" d: I3 _Envelope utility use to protect DOS applications:" i: ]- b7 \9 ^4 h% Y& w& l, m4 D

" `4 Q' X: k( \2 b/ ~8 E6 ?; m* \/ `7 b% I; v8 h
4C19:0095   MOV    AX,0911  ; execute command.
- @$ E( i, _/ Q2 V+ g" q4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( ?$ h3 y! w2 I# z( @4 g+ u4C19:009A   MOV    SI,4647  ; 1st magic value.
; x$ D. b) Z5 H+ s# ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: o+ Z/ k; F  A! @0 G& ~8 ]' v
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- P/ `1 G; W" z+ ~$ n3 w3 a
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ C: i# V4 X! |9 }6 Z) J) c5 i4C19:00A4   INC    CX8 ]2 b9 u; K# M7 U+ X
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute  j3 k6 w) s3 [/ W. P3 D0 X
4C19:00A8   JB     0095     ; 6 different commands.
2 N+ ~1 @- z) Z. J7 z, d, `4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 w: [* o/ [. s- L4 C. i- w! d4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 r' }  j5 G0 ]
. y& c* y; k8 T
The program will execute 6 different SIce commands located at ds:dx, which
# M% t& d& h3 p, e5 [) B2 ]# Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 {0 z# K" c5 C* `

* L, j& n. r' ]$ o% x4 d. w* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 ]7 o" l2 D- Y" O& Z
___________________________________________________________________________
5 b) w% P# }7 s$ \! l. I* [% {9 X# C
5 P# e; r+ ?7 X% s4 K5 w
Method 03) v; O5 T) c( T
=========
( Y: ]5 |1 E. O: g. p# p
3 j" w7 m& C5 u" ILess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 L- K9 ~3 q5 Q. t6 q9 \
(API Get entry point)
) j7 O3 E! w& j        
6 p: v! \" d; U) V/ A, m" ~% z9 ?( h
+ j& j8 e% R" S5 ]2 f; V    xor     di,di
8 ?( u7 }# I% y2 O$ \* `2 I7 a    mov     es,di
* S0 M1 Z3 k+ r& ^0 w8 M$ F    mov     ax, 1684h       6 {2 b* j! `! j5 W/ U% N
    mov     bx, 0202h       ; VxD ID of winice
$ r) c4 m) s) j% D2 w    int     2Fh
- b' M9 P' s- P, X$ C' W    mov     ax, es          ; ES:DI -&gt; VxD API entry point% y/ j* ?7 `% C7 L) P
    add     ax, di0 z4 L' R; |$ F" ~
    test    ax,ax$ i0 a5 u9 g  y2 Z( a& V( Q+ z! X
    jnz     SoftICE_Detected) m3 E+ \9 c* m0 b) Z3 o
5 r0 S0 f$ Z* t* ~, T# }, M
___________________________________________________________________________
/ M0 m  \" X* q/ ~8 E4 [# D0 H0 Z* q: x4 w
Method 044 M1 {, |! d1 i5 C: U
=========6 O) J: z  i3 b" L# Q9 [% u
* F5 S! `5 ]0 Z9 P
Method identical to the preceding one except that it seeks the ID of SoftICE2 s! d3 @+ I9 K
GFX VxD.' [& F' U. u2 c7 D& i# ~* y0 _4 \& `

5 N; ^. k2 `' M/ J' C2 N    xor     di,di5 _2 q+ c. L( g6 m
    mov     es,di
6 P: _0 b+ p% e8 `) y/ R3 \/ t5 t    mov     ax, 1684h       - a, y( L3 _& B3 F' N$ U# x
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" H) Z. F" q. n4 a. g    int     2fh
, Y4 m1 R0 N# t* W7 p    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  z, A- L  }! ?, v& Y2 d2 H    add     ax, di
, v( W! Y0 [  c2 I6 s' g- ^    test    ax,ax
. x% w3 _0 G  U2 u# R9 S- A% A  [0 U    jnz     SoftICE_Detected
7 p: ~+ I% t  c: B
: A" p/ Q- B8 y2 Z__________________________________________________________________________4 e+ O. Q7 T# K, U0 }2 H

+ o! D9 y" r0 I% }0 ~
# |9 e8 q( i/ I" |  G- z2 H2 ^* PMethod 05
8 F+ T1 k: G9 T8 _4 Y' d=========4 }& _2 y1 i* ~  ^% B

- ?% v" d8 E+ ^: ]Method seeking the 'magic number' 0F386h returned (in ax) by all system! I8 Y! @6 o7 ^0 E- Y( a7 r
debugger. It calls the int 41h, function 4Fh.
. X$ B  p% Q$ H! YThere are several alternatives.  - U1 I3 a) J! M) S& U+ h0 X- K
4 Q& K9 Q0 e/ `
The following one is the simplest:
4 r0 }1 a1 x+ A' X
# x) ^, T  L% x) I' B1 R    mov     ax,4fh
4 l/ r& K* ?8 `) k    int     41h
/ c+ O  i! N4 \; U, Y: {" E    cmp     ax, 0F386
: d! l0 f6 W- Y    jz      SoftICE_detected
9 v3 |  v) [5 L1 m/ [5 ^. g1 b0 Z4 p1 y4 r8 x1 p$ y( T+ ^

+ \4 a2 z5 J7 x7 P, i5 `Next method as well as the following one are 2 examples from Stone's 7 v6 c9 N: T2 x. a1 [6 ?3 X
"stn-wid.zip" (www.cracking.net):: ]  \1 c  p8 u0 _1 u

1 b; h  p  o1 Q! \5 f" H. W    mov     bx, cs
+ c4 Q$ }6 p( f0 M/ g; o4 U2 G    lea     dx, int41handler2
, S+ @% G  T9 P, A4 i5 d; W    xchg    dx, es:[41h*4]; k& X) Z7 {1 D" C4 |6 K
    xchg    bx, es:[41h*4+2], O3 |9 ^0 X5 Z. }0 k$ h
    mov     ax,4fh2 f* G6 p2 `! j. j6 C; v4 a4 V0 E
    int     41h
4 Y% _3 o: S6 r4 D1 A0 `( x    xchg    dx, es:[41h*4]
/ z, F5 n& Z, k2 V/ M( i! o    xchg    bx, es:[41h*4+2]
  s: \+ r" e' A9 F    cmp     ax, 0f386h: X1 _8 P& p/ T4 J2 T% ~
    jz      SoftICE_detected0 N1 A; Z% i. j: l

4 A* w0 ^+ p. {9 I. Y. ]. `int41handler2 PROC
6 j4 \; W/ H% O7 b    iret( C- B0 G, N+ P/ N2 E
int41handler2 ENDP% ]; ^# V2 k% D6 ~9 ~
2 Q- K7 o" L8 a: W9 L

6 |6 ~1 [# e' P& _, N7 g8 h_________________________________________________________________________
4 u8 U* L% D5 d# g1 f0 o
; I- H# s) m, T7 c. x$ f1 p
4 S2 |6 _) t" H# ^. A* qMethod 062 k  C2 @* c" m; ~$ N5 F* z
=========
8 d+ I4 f+ x6 ~) k5 ^
% s9 \- c! O7 {8 S0 _1 d" o; L  i4 G% I- A
2nd method similar to the preceding one but more difficult to detect:; Q' h: _8 ^+ I3 E

+ ~& `& I; t) K7 E. V2 c! ^
/ H2 z/ k6 N# z1 e& r* y$ R. gint41handler PROC: U" \7 H2 o, N- ~
    mov     cl,al
$ t7 s' A2 I$ X; l% i( Y4 ~$ I1 `  B    iret, |5 K+ J4 D; h8 V. D5 V/ [
int41handler ENDP
: }$ f. W' a4 a- H  q( Y
2 c/ s0 t# f2 X
. f! o% V3 x: o$ }1 l! d    xor     ax,ax
0 K5 w$ s/ L+ R/ ^( y- @; B    mov     es,ax4 U- y, K4 O' k- e
    mov     bx, cs* x7 ?- ^. }$ G
    lea     dx, int41handler0 a7 E. }- C( x. u3 ^* y8 }3 y
    xchg    dx, es:[41h*4]
9 q, s' y' n+ \    xchg    bx, es:[41h*4+2]
2 G  Q7 X5 G& \! h    in      al, 40h. x5 I: h" {( }( L' D: G4 p$ W3 s2 ~
    xor     cx,cx
% x+ U: e/ e+ `, s. I    int     41h+ i9 C$ H. t( g
    xchg    dx, es:[41h*4]
5 z! a/ U2 L$ C0 E$ M    xchg    bx, es:[41h*4+2], d9 H; D- Q( R
    cmp     cl,al
; A$ a1 d; A% Z    jnz     SoftICE_detected
* N& |5 x+ T& \" E" q) ~9 b( h3 \
_________________________________________________________________________
8 m. c& ^) y! F1 c8 f$ h" Z- n' Y7 b) r9 s  q' G& ~
Method 07/ V" P2 ^* J! p  T
=========  \3 s- q2 S" G: M9 o9 o6 a/ `
; u+ t9 A8 M# v5 S
Method of detection of the WinICE handler in the int68h (V86)
0 e. P1 E6 I* ^# A9 o
& ^# U; F1 f* B  P) h8 b    mov     ah,43h
5 |1 t/ Y/ y; [8 o    int     68h
+ K3 g4 h* z4 i  ]    cmp     ax,0F386h
2 F9 K' x: M3 t. t* c    jz      SoftICE_Detected1 b* q- ]" P9 C, z- |
- ?4 ^/ a' p" F/ \" x

  A3 R5 `2 D$ ~) I; D1 c  z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit/ \) S  L  ], L: a: q  u
   app like this:
0 Y7 P& ?* }2 _* {2 O! c, }" v( x- t. b
   BPX exec_int if ax==68  K( ^# x; H3 l/ d- d7 ]$ v5 s
   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ j- \9 \8 d2 q5 W9 o! C. \" c   located at [ebp+48h] for 32Bit apps)4 k% y$ f9 B8 u- K/ O
__________________________________________________________________________
; K) D, r2 m& K( q" V- A8 k% d! n& L- V2 Q& |6 g! y

3 q: q" v$ P; e% qMethod 08
, t6 W. y0 S: w; d3 N# k7 w=========
0 F1 j4 x% c# `7 j9 ~
  N8 \+ \( b4 v7 ~& qIt is not a method of detection of SoftICE but a possibility to crash the
9 k# {2 Q' Q! C+ K. Q  Y! Jsystem by intercepting int 01h and int 03h and redirecting them to another
4 Z$ B; q- \; n2 O8 Troutine.
5 k: J8 K; V6 i+ H* x3 HIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  l* I# {1 R) R0 E7 X
to the new routine to execute (hangs computer...)8 H! ]/ _  G1 @2 P" q
- H% n4 O- y7 v' s
    mov     ah, 25h/ ~4 F- B3 @7 P6 \6 h9 j1 l
    mov     al, Int_Number (01h or 03h): Q6 y# @; I  K7 k! v
    mov     dx, offset New_Int_Routine
2 x5 O; T1 z4 D  l    int     21h
. R0 B8 ^+ z1 p+ @. D, ^
. l8 p) J9 p( ?- J6 z" @; m4 i__________________________________________________________________________
/ X$ x5 g" q7 G9 _( b2 ^9 K6 k8 `) A+ J$ v. `
Method 09
1 S. s) k' g' M$ f6 X5 O6 T=========
8 ?9 a, F3 n3 C* H
; p6 I) @! `" w- I0 J6 V- H5 U# NThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# f" {& w% g& ~+ P
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 @6 p+ O% g) H3 w  LThe Get_DDB service is used to determine whether or not a VxD is installed
- i" i# U7 e( k3 `9 [- F5 efor the specified device and returns a Device Description Block (in ecx) for* @! N6 j8 U7 C# m; \; N. W
that device if it is installed.
9 I4 q( Z0 S' }- y+ v  @- ?, [+ z$ Y* I7 Z8 V2 Z/ o+ E
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID$ k# \! P  E8 h' U  A
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)' x: l4 a, @( A& b$ ^
   VMMCall Get_DDB
! p4 U% Z( q' p2 L1 m1 k- q   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! i4 C, G1 d! `7 _+ ]/ z3 `$ H: Y$ L2 _7 J
Note as well that you can easily detect this method with SoftICE:- z8 V8 {% X' p" y
   bpx Get_DDB if ax==0202 || ax==7a5fh8 v6 H& m/ A" O. g- M4 {) ?* Z) @

) P8 @9 H/ Y; t* C' G__________________________________________________________________________
: j; a6 J6 S- q- T) c( T. }( A; y: K9 B; K: J$ p
Method 10
. P  Y% c* S1 _; I0 a; i5 X, m=========/ u. x3 H9 _. `, b! f9 g
! z2 y) Z2 [9 X: p) C$ ^
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 j5 }: w, T% N3 b$ W  SoftICE while the option is enable!!
" W( h; G6 v- a1 n: ^
  i9 q3 r8 ?8 SThis trick is very efficient:
# I- o' |" _# d- s7 ?( w5 Xby checking the Debug Registers, you can detect if SoftICE is loaded
2 `: X& s  S% s: i(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ B! g' m$ W2 h% @
there are some memory breakpoints set (dr0 to dr3) simply by reading their
4 j5 m- Q; r% E+ Vvalue (in ring0 only). Values can be manipulated and or changed as well
# x# a% N4 b3 o( @0 Q/ d(clearing BPMs for instance)' ]% d) [# d# x& h! j  z
  M$ e0 M! s4 x4 g1 _7 f
__________________________________________________________________________) F3 |5 p" o9 Y" j; ?# w; y/ e) d
: S" N* a& W; v; h8 P5 B9 u
Method 119 J/ o0 I: `3 f3 t, f
=========
$ Y/ a$ r! F* n# j0 ?3 [; z* |( T# o+ p
This method is most known as 'MeltICE' because it has been freely distributed
7 Y) i( d) V2 k" @4 c  S0 Tvia www.winfiles.com. However it was first used by NuMega people to allow# x9 N3 K( C2 k0 n% a* E
Symbol Loader to check if SoftICE was active or not (the code is located
% t3 g( S" m: f- o2 R- I9 c  T; Jinside nmtrans.dll).3 t; S: D1 |, a! A; K, {
4 F( Q/ G& Y0 ]' B; V# n! N9 b
The way it works is very simple:) T, A& s& T% U4 P2 o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 C1 s! c  G8 X6 Z( T  N, c9 ^WinNT) with the CreateFileA API./ G% q2 l5 o/ S- U- B# h, l

6 r4 i5 P% {! S+ u. p' ~4 o, nHere is a sample (checking for 'SICE'):
! r! q7 H; H6 }) g+ o) i
* \" f, ?  S7 g3 w$ w( d* iBOOL IsSoftIce95Loaded()
" m2 _* u9 Y2 O+ k  Q- J/ w* [{
: z3 S3 p6 ]+ W; K+ @) y$ Z8 |5 T   HANDLE hFile;  
" o, q* }; r# E6 z0 }. {$ C5 [   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 _- d$ o9 g0 S0 W  @3 U                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' M+ S9 r, x/ `$ ?                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- r: q- t$ Q. M4 w' y. t   if( hFile != INVALID_HANDLE_VALUE )
6 s* c. Q2 r, F1 S5 l- y   {6 w5 M9 ^% F) B$ J" [
      CloseHandle(hFile);
% K0 }* I7 Z3 R3 C' i. D      return TRUE;4 s; c# h! d9 ~  `9 l* [
   }
( \; ~0 \+ O& h, Q7 ^; p0 w$ a; M   return FALSE;* `. K% V0 v0 p3 |
}' e) H8 M# W) D+ u

$ n! d0 S1 z, [Although this trick calls the CreateFileA function, don't even expect to be
. m( }( R, C+ Table to intercept it by installing a IFS hook: it will not work, no way!
9 @- i7 \5 a6 L8 b4 EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ d! e9 f$ e- R% bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, l% i/ p  ]; Z$ nand then browse the DDB list until it find the VxD and its DDB_Control_Proc
( A( d+ J& ?1 K" T( s, X7 Q& Pfield.
( l5 t/ Q9 U3 H0 _, n& lIn fact, its purpose is not to load/unload VxDs but only to send a
8 E$ _8 K1 s. cW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
; {  D. X; B" q3 J8 O; [to the VxD Control_Dispatch proc (how the hell a shareware soft could try- i( H' T) c3 A9 n* M2 P6 o' c5 |/ X
to load/unload a non-dynamically loadable driver such as SoftICE ;-).1 g! L& J2 i& S5 J) {6 L, C+ Y- k
If the VxD is loaded, it will always clear eax and the Carry flag to allow
: t4 z! X. z+ h$ D0 B9 h  K; q7 Jits handle to be opened and then, will be detected.
- W& ^$ M6 \- {1 RYou can check that simply by hooking Winice.exe control proc entry point* W7 O7 i* {5 w) j+ K0 D& S
while running MeltICE./ `  T  ]; |& y# `- a8 D

6 W8 e- @( c0 `: W( \, j1 J% Q
$ c% \! E( U) P  00401067:  push      00402025    ; \\.\SICE
: k' w* z+ U0 |5 I- [* w  }  0040106C:  call      CreateFileA
! z, D: e$ G. Q# ?3 |' `. X* t  00401071:  cmp       eax,-0019 P( I3 R% G  J: O! g' _2 @
  00401074:  je        00401091
, F; F4 {: n0 G& a9 t5 B( `# f: I& j( v5 e  U. G
2 A/ h" ~. N  Q6 o( a& |: `
There could be hundreds of BPX you could use to detect this trick.
7 f, a3 P5 h. P: P3 q0 A-The most classical one is:
+ r/ v# L. {, @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' S! K" d) E: n6 z* ^5 L3 c
    *(esp-&gt;4+4)=='NTIC'( @& R/ I6 w. T5 L7 J! i8 C: O

: c+ l0 f5 A. C4 m3 u-The most exotic ones (could be very slooooow :-(; e+ q' g  y; ^
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
2 F# f! B+ R8 A6 }6 q% }1 D% K  i     ;will break 3 times :-(
4 d0 l& [. K' \  d* a. X
5 F' P8 D; `$ H1 m-or (a bit) faster: ( x1 n" o9 V' U  L/ d. h% d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ @9 q& h& v8 Z) S- n% J
' X$ D) E% i8 ]8 S) u   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 C, y' j" h" Q! f     ;will break 3 times :-(4 r  V$ h$ L. c0 t& `# z
3 ]5 c6 M1 a5 S3 k* c
-Much faster:9 N: u8 x6 a, r( A# G/ ~
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 z" B4 D2 Q5 Z# N& W

' q" q' _+ g/ @0 TNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 B' L7 f- z# H9 ~7 rfunction to do the same job:
: a1 a* l' H7 o/ U$ b% l* s6 W1 B" `4 _  N
   push    00                        ; OF_READ0 e, W4 d- {- R( M. S6 y
   mov     eax,[00656634]            ; '\\.\SICE',0
# P1 \6 b6 ~0 }  w   push    eax2 y  U$ y$ P9 v5 f+ j, n8 ^
   call    KERNEL32!_lopen
0 L4 D' S! x6 \& i- h. r# G   inc     eax0 I/ F3 r  I/ B1 L
   jnz     00650589                  ; detected
+ P7 M! x6 u+ U# G   push    00                        ; OF_READ
# h: Z# _) X6 k- ?: i6 J   mov     eax,[00656638]            ; '\\.\SICE'- _! I; D2 Y" S
   push    eax
0 d; T9 N; Q0 h* M5 Y' a9 T   call    KERNEL32!_lopen
: i2 ^: k9 u2 x# _& ?" M   inc     eax
# Z! A: K" N/ ?! W$ ^   jz      006505ae                  ; not detected& ^  b, D# Q- R* h9 ]# ?2 P( @

- x9 J& ]1 V  S! R& p& T) V
: x8 }5 P" _7 B- U/ _. z& {$ B__________________________________________________________________________
: ^, _# p) i; {& d1 T. ^8 U1 a4 x: K  [  ^: ?
Method 12
% r) c  x2 W" G. M3 w=========
4 B/ Z+ a3 l4 C# A1 b% ^, C3 Q' \/ Z% B, l$ I( v
This trick is similar to int41h/4fh Debugger installation check (code 053 E! s& z* h' H) X; p+ E/ e
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- H3 _# L( {% P+ las it uses the VxDCall backdoor. This detection was found in Bleem Demo.! v9 F* ?# U* W# S9 y* r
8 g" L) P  X/ d7 h( R+ }8 o4 W
   push  0000004fh         ; function 4fh
  V6 ~, I8 ~/ n   push  002a002ah         ; high word specifies which VxD (VWIN32)! H1 \* Z; T, P  ~$ y1 r
                           ; low word specifies which service
8 ?3 F, F4 B5 _  D; t9 e5 B                             (VWIN32_Int41Dispatch)
5 H6 d  ?# ?* l% I) L/ M   call  Kernel32!ORD_001  ; VxdCall
8 \+ `2 V4 r+ h2 S3 `   cmp   ax, 0f386h        ; magic number returned by system debuggers; G# e6 Z! R$ z. T
   jz    SoftICE_detected
: F% a/ e' m1 X$ c
+ B  ^+ N5 H( v4 R0 ]6 sHere again, several ways to detect it:
+ L9 Q; |' _; q$ K
% M6 x( @5 D8 i. m9 a) [' A    BPINT 41 if ax==4f
7 v0 e2 O! v2 Q- B* G
" _3 G" U) T6 d( L( U9 S' J5 s    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
( i5 N' }" L5 ~0 j# I
+ F0 b- K) x; `* C$ l    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A: N- Z- [$ ^6 @
1 C; i- _2 C4 T7 M" Q8 f: a7 A
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! B: K/ d/ u* G: H) b( U
" L. F% @. N7 ^6 E$ H
__________________________________________________________________________
$ M+ N: a" X( M; v! Y! v
; j  K6 C1 v: OMethod 13
6 e* G$ v: g# X=========7 m8 _% y( L# d3 j; a

( J  L/ d# S5 O( h  WNot a real method of detection, but a good way to know if SoftICE is# k& J7 \, D9 f
installed on a computer and to locate its installation directory.
  j+ h- m  B5 f9 I8 U5 u9 n& g. D/ {It is used by few softs which access the following registry keys (usually #2) :
( f7 y7 N% m7 [$ n, L$ c; Y/ z9 s8 Q3 C% [  N* H$ T& P8 C
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 A7 a) ]( J  _( j5 M\Uninstall\SoftICE
# b- m- P" f" Q- [; O& b$ @7 G-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 G- n3 j. M- }$ c-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ {# k  u( u1 I* I6 s) \5 ^
\App Paths\Loader32.Exe
: U3 u9 _! }4 a! j- ~) p5 F
4 ^. E( `/ j, M& k/ l5 @
& S/ W& b# Z5 @7 j* \Note that some nasty apps could then erase all files from SoftICE directory
3 h- |8 V) S& e4 {0 V(I faced that once :-(
' ~. P# i0 l7 _7 I7 |0 g) V
1 ^, B- y- y* n- W  @, K( nUseful breakpoint to detect it:
$ Y; x/ v  w0 W+ G7 `0 N" |1 ~
" s6 T1 X! t, b9 M, d( R3 n+ k% R' B     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'6 j3 [4 y: e/ D5 }1 {
/ j" i3 Z2 X6 z. n) U: M
__________________________________________________________________________
  J* C- ]0 P2 f: N; C$ b6 n% P2 h) z% E# h' ?7 w: A- C
6 m% ]: O5 q1 h! W
Method 14 # {1 e2 n. ^, B" ~9 p; n. n
=========9 v+ B/ a( D! z0 @7 ]8 M

! L& a! P' t3 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ m2 G% @* F% Q2 P# ?9 S# |7 his to determines whether a debugger is running on your system (ring0 only).$ _% a3 j: {# L; v# q- j

0 K0 ~% Y2 B1 H+ S6 c8 G" @) Z   VMMCall Test_Debug_Installed' L1 H+ A/ z' N3 v5 }9 F5 J5 L
   je      not_installed- [- t4 H: h$ x, u" J! }

) ~/ ~3 a2 j, |& `2 T" V! G0 kThis service just checks a flag.
+ T& g$ `# m0 }2 ^</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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