About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% a% l1 B6 p+ C1 J! ?- u& X
<TBODY>
: v) J" G9 B" e" g<TR>/ a* K( r0 S- {
<TD><PRE>Method 01
- H9 t1 s* ~( ], U. E=========- ^5 V) ?( `4 C( i3 ^2 U
+ Q& T/ X! }6 L
This method of detection of SoftICE (as well as the following one) is$ Q$ ]. Z, {) o7 m5 f; ]; s9 ]( z/ {
used by the majority of packers/encryptors found on Internet.
& i4 V0 i# C; H2 j/ v# P9 XIt seeks the signature of BoundsChecker in SoftICE6 U- q. Q9 t6 J* w- F, U( Z/ s

& P' _; m+ O# g9 Y- K    mov     ebp, 04243484Bh        ; 'BCHK'
% ]! ?" n; k# c( s6 O    mov     ax, 04h
& e9 [$ Y# T7 {$ o! ]    int     3      
$ m' U* U( J5 n: K; }0 _" x    cmp     al,4& N0 N* Q. w2 Z8 e! U
    jnz     SoftICE_Detected
( F8 n6 \* m8 h# q" R+ ^% s2 J# Y1 k' O3 B0 w/ i& S$ T6 u  A/ ~/ E
___________________________________________________________________________8 H5 n( x& O: ^2 n; g

4 P. g7 @" p+ S! IMethod 02
/ i" d3 G- o# E5 z- K7 U=========
+ [. K0 B; g% X# v
7 z  j- x- t4 r( c0 G1 AStill a method very much used (perhaps the most frequent one).  It is used
+ I( H* \8 a* _, v' K( Lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ y/ o5 p; R. ?) U8 Q, K2 P6 zor execute SoftICE commands...# c0 ~7 @" v1 T7 g: B7 F
It is also used to crash SoftICE and to force it to execute any commands, R% v& ^1 L9 j, F; R
(HBOOT...) :-((  
9 s; ?1 D: }9 p& j( U1 A! C4 O/ l2 q2 e
Here is a quick description:: ^! U0 ^1 [- {! ?' s" J' @
-AX = 0910h   (Display string in SIce windows)
' V1 J* e! b5 @3 d( e) I2 z+ m- `-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)3 O3 x8 K* ~, J  [* K
-AX = 0912h   (Get breakpoint infos)
' m; b* i' e' _0 Z, D' T3 _9 Q  h7 q5 K-AX = 0913h   (Set Sice breakpoints)" u- _# r* K0 N: C3 }$ l: T
-AX = 0914h   (Remove SIce breakoints)
0 |3 T: e3 h- Z4 m1 p- y! x" B7 d# j& Z7 y% O* S
Each time you'll meet this trick, you'll see:3 u% d. J7 Q4 J/ E/ {& A/ M' V
-SI = 4647h: `8 J) ]; z- x! u* y6 ~  E
-DI = 4A4Dh% ^) j9 J& E0 `/ W: O: p
Which are the 'magic values' used by SoftIce.7 M* w% ~' o& a5 i: [+ @! \% f
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
* D, @  Z& G+ _1 m7 l) ^$ \/ J
% }' I  z; A* EHere is one example from the file "Haspinst.exe" which is the dongle HASP
3 c( W. y7 L" T0 i. a/ f+ JEnvelope utility use to protect DOS applications:1 f5 u+ L8 R6 {) ]7 {* L3 J

3 {4 Z! V1 ?) L
9 b  k/ r1 `! T$ a2 [4C19:0095   MOV    AX,0911  ; execute command.
; j+ Y9 m3 m8 O: r1 f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# B" ?% B; x% w  a4 N( {' e% e4C19:009A   MOV    SI,4647  ; 1st magic value.
7 j) m0 l+ m( @; ^8 }' J( A4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 W/ U  H' e6 L7 d8 a1 L
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 u( M6 r' ~5 w5 E. D4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; S' _: v! w$ S* `& D4C19:00A4   INC    CX
2 v8 e9 b5 }" ?+ _3 E4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' n, w7 A' D& t: y& q% O9 a. P4C19:00A8   JB     0095     ; 6 different commands.
& [/ {% D# q5 |- w  M: m5 E' q$ i4C19:00AA   JMP    0002     ; Bad_Guy jmp back.! C. Q! O0 L1 _( N/ E" A* s
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); m. ^1 T: {* D6 P7 I  I9 Q5 }* S$ d
7 _3 Z; ^4 D; v% N
The program will execute 6 different SIce commands located at ds:dx, which
5 q+ w5 M" P- _are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
( @& Z" J7 N' B, {1 X9 E+ R
+ Z1 N0 [) a2 k1 S8 ^* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! u9 M) r  _/ d4 b8 H
___________________________________________________________________________
# Z" T, U3 l4 W: f4 m
7 a& K  S1 d, i2 L* @7 Y& u, {+ M) F( W4 p4 E
Method 03! d% ?" |) t6 P
=========7 q* o9 Q9 |0 |1 j' d# x( T

: v0 y% R# A6 X, N. X3 K* ZLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ O$ c# ?1 K; x" d/ P2 U+ F' Y(API Get entry point)6 X' o1 h, u! }, B+ @
        : ]( m8 ~$ E, R

/ K; A& _* a4 ?9 o    xor     di,di- E: Q) U3 G4 {' W: R& k
    mov     es,di
, i" e/ {$ z9 Z4 ]% d    mov     ax, 1684h      
' t3 m# o6 Z! ~: N& [2 J' I    mov     bx, 0202h       ; VxD ID of winice! d8 s7 F& y; ?; H& ~9 ?
    int     2Fh
0 |, c9 d9 t* Q$ Z& l8 K    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 V0 t6 f5 e7 U+ n
    add     ax, di! Q( Y8 G; G8 g- K7 \# V0 ^7 g
    test    ax,ax
7 W6 O/ ]6 c/ ^, p8 A: v    jnz     SoftICE_Detected
0 d8 k3 F5 M6 s
7 Q9 K0 l0 W6 Z, x% X___________________________________________________________________________. [/ Y: D2 {. l3 N/ U

& g# z& t5 [: m) Y3 l& w# oMethod 04
6 m; `! v4 R8 J2 s% ^/ G=========; _7 [: @( \* N) E% h" K; y
& c% {3 ~& E- T; f( Y
Method identical to the preceding one except that it seeks the ID of SoftICE8 z8 ^3 h( L! _) h2 s0 k4 i1 e
GFX VxD.; `9 f  E0 u6 T+ r$ y+ s
! d* @) Y3 \7 V8 v7 ], i6 Z3 l
    xor     di,di6 A4 J$ ^* E: T. v
    mov     es,di
) C  C! g: w9 t0 ^    mov     ax, 1684h       & b5 L3 O* V: t! Y- P
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, ]  A$ i+ d! `7 o# `    int     2fh# e7 b1 U4 v# d6 N2 ?8 _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 O# c$ E' @  c7 n2 ?6 S6 R, ]2 J) T    add     ax, di2 \3 B& c6 [% d. Y4 ?; R3 z( O
    test    ax,ax
; Z% d2 G2 |; t/ h9 T    jnz     SoftICE_Detected0 d4 C1 r7 h; H: g, y0 O

( T! S5 }: ~- `* ^# b& e5 a__________________________________________________________________________/ u. W- v) A$ o- z* A2 R9 c# {

" J/ V& Y- q8 f8 G2 ]: ~. N2 q) p+ A, I# z1 y9 n
Method 05) ]) M9 [$ ^% k
=========6 r/ S. y- G$ f+ ~! C) S

" Y+ f& i7 r9 E6 g+ }" S7 X9 IMethod seeking the 'magic number' 0F386h returned (in ax) by all system
: u( q! ~1 P; g, v/ Xdebugger. It calls the int 41h, function 4Fh.
5 R  n3 o9 v) }& y9 X: m' nThere are several alternatives.  
# G/ O9 [! u% r3 M8 x6 Q/ Y% i2 X1 W1 m# ~
The following one is the simplest:5 W( t& t5 \7 e0 ?
1 I% ]( L) l0 f' M2 e) k  h
    mov     ax,4fh
0 K* h$ s4 p' @) |* W# U2 n6 f    int     41h# E5 m$ T8 _# C# X7 P" B
    cmp     ax, 0F386
3 ]- d0 i6 o/ J0 ]2 }    jz      SoftICE_detected; s7 k! w9 s; {
9 R/ _2 x" l6 B4 N- `3 o, P. B

$ c2 l5 e; x6 M9 x. o1 I( `6 DNext method as well as the following one are 2 examples from Stone's 4 j2 ]: i' S2 p9 r( B4 @
"stn-wid.zip" (www.cracking.net):0 q+ J- y; H, b0 x# P- S
9 a$ E  h; G( T" l
    mov     bx, cs" {) T9 @. d, _! u: k( f
    lea     dx, int41handler2
, }4 S( S) a/ ?    xchg    dx, es:[41h*4]! L4 S( n" b& t, J0 p) [7 I6 q
    xchg    bx, es:[41h*4+2]
( z+ T( C; h- n/ Q    mov     ax,4fh5 w; m4 c+ R% `+ B: H. Q; I9 D
    int     41h
( x$ g5 I$ ], z    xchg    dx, es:[41h*4]
- `) U. }" _/ H/ i- F    xchg    bx, es:[41h*4+2]
4 u! q  {# i' V# K8 R5 [    cmp     ax, 0f386h: J! D6 O% y! N0 {0 k
    jz      SoftICE_detected2 v- F) r/ Q, w$ T
+ t5 {+ V  q. q" n$ t
int41handler2 PROC
' o0 g; V- c4 l$ w$ v9 o' f    iret6 k5 D% o5 k4 D# b  [4 Z
int41handler2 ENDP
2 R! R+ r( z# A' D" D! R
* }( |. }$ P* `8 x5 M: T: A) M5 q' k3 V5 T
_________________________________________________________________________3 C- u2 a8 a: X' `4 H

. B0 C6 @( g$ P" p" W% r0 ?( c. N" k; V! z! j
Method 065 j7 J' C5 S& x# w- ]
=========
+ E! A* I6 A) I0 a% a- L3 Y( Z5 c: A( c2 n
1 I8 P0 Y) w& L* Z+ ?2 V
2nd method similar to the preceding one but more difficult to detect:
$ K7 J7 C. L. Z6 g$ A& k+ K4 i% X! K( |

4 q, E; I, A& y4 {( Pint41handler PROC
( u2 c# U( X6 @9 k  j. o; {* K    mov     cl,al
3 d3 _/ m6 o2 S    iret& g) H+ r& H8 u
int41handler ENDP* ?( |  i! p2 L9 C, I; m3 t
$ W5 {/ L6 ]- }# U

7 b7 l0 I9 d! o8 M4 @) V    xor     ax,ax
" M' W) J, v( G    mov     es,ax  E' p7 b  F7 d6 L" I: R
    mov     bx, cs- _5 q# c# x" B- N' d/ Z$ o* s
    lea     dx, int41handler
# W8 n1 \/ K0 f    xchg    dx, es:[41h*4]4 C- S+ I! M# A
    xchg    bx, es:[41h*4+2]
; X% a: W6 v* X* N/ j( p2 V    in      al, 40h  Y0 u, r; t& I3 d4 Y; G  l( x
    xor     cx,cx. g" m% d6 _: E
    int     41h' d2 @- Q5 a3 Y+ J: A) G6 L2 ]; T
    xchg    dx, es:[41h*4]
- q8 q2 }* M4 F! D    xchg    bx, es:[41h*4+2]+ j* S& p9 L# Q% y; J+ [; J, y
    cmp     cl,al/ X1 o0 t! I- X5 \
    jnz     SoftICE_detected6 {: f3 a; W1 A# k+ u" u

* h0 f; p9 Q" a! s_________________________________________________________________________0 A* Z. ~+ Q4 E

4 ~3 S6 x$ Y/ M" c* fMethod 07
8 v- E4 V- T4 a5 q. x=========$ s% D8 K$ `$ k9 h) m. ~

4 c4 H' d6 k  D+ U- ]Method of detection of the WinICE handler in the int68h (V86)
9 ^: j8 ^8 u' o" F/ y; o
- M; O( h6 h6 }7 [1 n2 O$ X    mov     ah,43h
* I8 ]) E; k  E; U- d0 \    int     68h
+ R! c" Q  m* b/ K" S    cmp     ax,0F386h" w+ y: V% l4 M# ~  r4 {
    jz      SoftICE_Detected* g- W2 D1 x/ B: S2 D, i
$ k9 o9 m3 |# k1 k( \  s

/ o- F5 H& K( d9 x) v% n9 k2 w8 F=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. \  X+ E# {& A1 e2 Y6 P( U1 A: z7 j   app like this:+ U1 a0 ~- K4 v4 n
- e# w6 H: S2 p, e) B( L
   BPX exec_int if ax==68
0 h0 v, E% R! a" X6 X   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ X4 C3 a& Y' |7 U4 l/ S   located at [ebp+48h] for 32Bit apps)3 e0 |" j% k! j4 o6 y8 C4 n- V
__________________________________________________________________________" @4 U% ]. C  ~0 m  U- F# j5 D/ `5 |6 }
$ m* D9 {0 _1 n$ h; p( z/ |

) N5 ~  N( Y  J! h) N. ?4 g9 \Method 08
5 a. k! m' u, @( K/ b! d( a0 Q' \=========! H, i& O$ U0 E9 k, i+ D% h0 X7 l6 ]

: j3 I. z' v  hIt is not a method of detection of SoftICE but a possibility to crash the* l/ \; v4 Z% \
system by intercepting int 01h and int 03h and redirecting them to another" ?$ F6 i) p# |; c
routine.
% ~, E2 e) w0 lIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 \) ?) n% D3 k6 J! _
to the new routine to execute (hangs computer...)
3 m+ r5 A- E5 G; v6 C* x# l0 O( O# V/ v) c: w. s
    mov     ah, 25h
8 {: a4 e0 Z" C( L( ^4 B, C    mov     al, Int_Number (01h or 03h)
4 A- z! y$ l/ Y+ s. w5 e* c    mov     dx, offset New_Int_Routine9 a; E0 U1 X# I7 F5 `5 T6 P* o  N
    int     21h- p. _$ i* ]8 E; d; t
: S( b. I5 P; K* c4 O+ I" l& b. v
__________________________________________________________________________1 c/ t0 ^* i7 A5 S

6 S0 A8 g6 T+ e( C5 w0 }5 HMethod 09
3 h5 l5 V; y% x8 p=========
2 w* o. K8 o% C% p3 I# y: h; {, I# z/ ^8 Z0 O1 ~' o
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 G, i. J. N- ~  y; A- p2 F$ \
performed in ring0 (VxD or a ring3 app using the VxdCall).
0 l4 f5 K$ t6 E' A5 }0 [3 TThe Get_DDB service is used to determine whether or not a VxD is installed
2 v. g2 G* ^4 D# z! ^" g* wfor the specified device and returns a Device Description Block (in ecx) for' n# p/ |3 Z! y
that device if it is installed.7 Z9 q. g* z+ T( _0 f+ o

( X8 M0 y/ n& }4 d) q3 H( A   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 N4 W4 `% l, }5 ~/ U0 r8 p+ c   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, E4 z5 A1 E( Y) `   VMMCall Get_DDB$ k1 F! x; A; g( N  \3 v
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
) y9 Y- Y  k& {( ^3 F8 z
3 Z, k& I7 k/ n# f/ `( TNote as well that you can easily detect this method with SoftICE:# m  S4 f! f( H9 p3 @5 ^' o9 @- N
   bpx Get_DDB if ax==0202 || ax==7a5fh  A( f0 L- S* ?9 P3 m" P. T9 z3 e
, a- s/ y! t: B$ I" s
__________________________________________________________________________: _, d: f" g1 J7 ]9 z( i+ t9 p
. B: o. `  H4 F! B( _! A4 S
Method 10
% P7 ~, A( e& E$ u! ^& s9 \=========
2 R- l/ \' c" U2 ]
" u- o+ @4 c1 S$ \: P+ ?=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) t$ B- m0 _" _; K2 ~  SoftICE while the option is enable!!8 f/ P4 [1 }6 e* [
* W: q( |4 g0 u( `' H
This trick is very efficient:# x" \+ p' d3 D" e
by checking the Debug Registers, you can detect if SoftICE is loaded4 @6 i4 Y; }" S8 P6 D- `! g8 k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
/ s9 [  ~1 O9 ~' cthere are some memory breakpoints set (dr0 to dr3) simply by reading their
) e6 {1 Q1 s; Y# S. g" U  x" zvalue (in ring0 only). Values can be manipulated and or changed as well
- b" i- J4 D7 ?$ u(clearing BPMs for instance)
+ J2 [* f0 i4 a: t. z5 z5 E! F) _; c! r5 L
__________________________________________________________________________( c8 y% |( ]4 G( S9 L

% E( x9 v3 ^) P* bMethod 11
% I2 N; b* ?! k8 w) T=========7 `$ H7 G1 h2 G1 j9 k, o3 [! v
4 N, r* v: ?# _6 r% |0 [8 g4 t9 H
This method is most known as 'MeltICE' because it has been freely distributed
8 {; j6 b8 s" T! ?3 evia www.winfiles.com. However it was first used by NuMega people to allow8 W2 I3 g8 N: ~% Z- V+ b
Symbol Loader to check if SoftICE was active or not (the code is located# i- ]4 Y8 O& t$ J
inside nmtrans.dll).4 n& B5 U9 i' `; G+ m, Y

+ D; s4 A' Z* e/ y4 WThe way it works is very simple:  H- |1 M. `, U# P2 v  |$ j# D+ e
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* }$ q: T+ y- V1 b( F* MWinNT) with the CreateFileA API.
- v5 K; X- x1 S+ ~' M+ n4 C7 p" d$ ^. x- [" Q
Here is a sample (checking for 'SICE'):
. c' X/ W( L* P1 {" |$ v0 y2 E4 \4 [
! ?" K1 O+ m- L  w, MBOOL IsSoftIce95Loaded()
  `) G1 a0 N- ~5 j  [9 ~3 _, {" }{/ q9 q& M+ f! M$ B2 f
   HANDLE hFile;  
( J8 f' r9 K- }6 \9 r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: X/ v/ ?* j- q. L* J
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' ]; L8 u! }; u9 V                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 b5 f& j6 u( o) A. {" E
   if( hFile != INVALID_HANDLE_VALUE )
5 P$ W3 K" Z! U# j   {
) A9 W: ~$ J$ z" n, ~      CloseHandle(hFile);( v9 L& [+ J7 u6 E+ u" ?' W
      return TRUE;/ X$ ?7 Q( J0 a+ _/ N1 T! G
   }
- l8 U2 }3 q! M   return FALSE;
2 w3 j* @/ v; b9 Q$ ]/ p2 {) e}8 L1 ?' c; L  `/ m

( _; `- O+ p  kAlthough this trick calls the CreateFileA function, don't even expect to be
4 y" @- i5 }0 H, [0 D% h2 Bable to intercept it by installing a IFS hook: it will not work, no way!
, _  @- D' K  S$ ~4 OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F- l- ~( R+ o0 U  Q7 E) B
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); j3 W5 U( p* U7 |; h9 d
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
! z/ c. d# i6 p5 K9 zfield.0 v9 h  F- y+ e
In fact, its purpose is not to load/unload VxDs but only to send a ) V+ a7 V5 c$ F% U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 V+ O) H$ A: s3 X* _: x9 f$ V
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
2 a* d/ O1 I) wto load/unload a non-dynamically loadable driver such as SoftICE ;-).9 u3 \. |% i" `, P" Q9 i
If the VxD is loaded, it will always clear eax and the Carry flag to allow
; u0 A, B; @& C5 n' r, N$ ^6 z( xits handle to be opened and then, will be detected.4 {& y% z0 `% [* o1 A! s3 W
You can check that simply by hooking Winice.exe control proc entry point
# k. E2 M% ~% H6 qwhile running MeltICE.
; F, C2 y+ u6 p2 \; A8 q8 G, t+ g6 W8 Z, g: l

! c3 m% J& A4 ]" I' z3 e  00401067:  push      00402025    ; \\.\SICE
7 S  k" f5 l" f- Z7 H  0040106C:  call      CreateFileA, N# d( o1 Q* }" E5 t
  00401071:  cmp       eax,-0019 f) W, T/ _- V
  00401074:  je        00401091( T( j/ ^7 E, Z7 p) ]$ B

& l& [8 f9 L. `7 t/ M( P. b9 ^0 Y2 [) U* r* V
There could be hundreds of BPX you could use to detect this trick.
+ z4 T2 r7 V% Z4 s' }8 o. @3 `-The most classical one is:
, p7 F! j$ }/ g, `0 h  u9 [* R  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; }; r% i4 {- @  v2 ^    *(esp-&gt;4+4)=='NTIC'
8 X/ t( [, a% U! P3 D1 }! k& R2 ^3 Z' I
-The most exotic ones (could be very slooooow :-($ O5 d. e+ Z, k+ }! y8 u2 A( n+ D
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 d2 i! ]' c$ H3 r, K& N     ;will break 3 times :-(
' G3 x% z9 x; h$ g/ L: N
9 Z  G- B7 j* D) x-or (a bit) faster:
/ z7 F# P0 d. g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( q1 p  Y' J# o

7 p6 d4 @% l& E) E   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 H. X. u2 {- X0 Y3 |# \# }     ;will break 3 times :-(5 H4 K  \0 ~! p0 K/ [
( T" \5 k8 O1 x% }* B5 G
-Much faster:' i- j6 Y8 ]9 o2 c: X; w/ u
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 g0 m. E% R5 k

6 ^: o$ A9 _$ k9 T# t/ MNote also that some programs (like AZPR3.00) use de old 16-bit _lopen, n0 Y7 V2 P$ d( _' d# ]  s
function to do the same job:
7 g0 r1 S& `0 X% R' d
7 `- X3 r1 V8 |& S$ o- B2 ?' g   push    00                        ; OF_READ7 e$ W& Q1 l3 Q7 c) k2 I
   mov     eax,[00656634]            ; '\\.\SICE',0
- x( A+ z( c" Q' q. C7 r8 G6 A; v+ p   push    eax
) U9 t9 h, q# B   call    KERNEL32!_lopen1 G, d! ?2 J9 r7 ]
   inc     eax
: q: @  L6 p2 A8 E   jnz     00650589                  ; detected
0 Q# \+ z9 c5 L   push    00                        ; OF_READ0 K" w  X/ e" i* O9 ]5 _
   mov     eax,[00656638]            ; '\\.\SICE'
$ H$ {- ]1 N" E) H% V   push    eax# r" M+ w8 n- H* ~  q& Y
   call    KERNEL32!_lopen
2 ~9 Z) ^+ U0 B  F; ?   inc     eax7 _/ R, p* Y4 x& r: E7 I0 W
   jz      006505ae                  ; not detected
  t' ?9 P3 t7 C0 @* T8 O% [$ H: l& g: l+ ?
4 `+ N! G; X3 l' |# x
__________________________________________________________________________
; Y0 h  o0 T: Z. k  k" z7 E" X0 S9 P* v$ g- f4 j4 q' [
Method 12/ Z/ {9 T8 K& f6 u
=========
- X' l+ S' C- b/ k2 k% Z
% _' A4 X9 O7 N& NThis trick is similar to int41h/4fh Debugger installation check (code 05% F; Y5 a: k) G+ r3 k- d
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% {7 u; F, Z0 a1 r5 K& H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
& M" I8 {4 G0 a2 [. X$ h, M1 l# b: o+ K4 g, V* N" f
   push  0000004fh         ; function 4fh
" J( D) @$ h6 h( j; T   push  002a002ah         ; high word specifies which VxD (VWIN32)- _( \! P; Q/ d+ O" p6 m
                           ; low word specifies which service- @# \( L4 x3 j0 g* W. l8 E
                             (VWIN32_Int41Dispatch)
5 l$ I$ I: n2 f' C   call  Kernel32!ORD_001  ; VxdCall
) c" ?' ?; k! n, A- {   cmp   ax, 0f386h        ; magic number returned by system debuggers
* l+ f! E! K8 ]3 w$ [7 i   jz    SoftICE_detected, I5 D4 `3 H* I# ?* v0 N
7 X2 M0 [+ Z5 p3 C: y9 i
Here again, several ways to detect it:7 R. X% K- g" M
5 d9 f- L2 p. c7 T
    BPINT 41 if ax==4f- E" q9 }2 d  m, P" N# Y4 ~
- l1 {& `; X# Z% ?  C6 l+ H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: S7 p- q3 \4 G* N. y2 F- G8 f- N3 w7 R7 d7 H2 Q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' |9 \# X/ p1 V1 O9 @) O# u3 M$ y+ r# y4 n: f/ F) w& X% Y( i
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 Y2 E, c1 u! @1 q
" {' g& O0 \9 `1 R7 K* M__________________________________________________________________________9 n+ ?0 i9 s% T
+ U  K) }6 t( S" ?  Y
Method 13
8 B' U: f5 u5 ~$ p=========
! Y1 `; R) y. P/ f2 [& r7 N4 z+ \
7 @( |. r8 I# m- q8 d6 gNot a real method of detection, but a good way to know if SoftICE is
' u: u: M9 j2 Hinstalled on a computer and to locate its installation directory.
# P* {: O5 m0 \1 ?6 k/ Q& BIt is used by few softs which access the following registry keys (usually #2) :
1 W) a( [8 B# e( e) t9 ^# b2 ]
4 z+ j0 A; c6 R9 d( b' h-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' g% L! j! |- E2 a
\Uninstall\SoftICE
' |& P; t6 u2 Q; p7 X-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
( L+ k/ u9 G6 L4 T& u+ M6 _% |-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; f: R* H' s) y# r3 x\App Paths\Loader32.Exe/ w8 C9 i% d7 V* H5 A
1 k3 A) \+ `* \

' c5 Q% w$ p  r8 h: a0 QNote that some nasty apps could then erase all files from SoftICE directory7 C+ _/ J$ M2 \% w+ m
(I faced that once :-(( T" {/ q# @' G% }7 q

, O" }+ `0 V+ W' ]Useful breakpoint to detect it:
0 m9 J( D( C6 l, n0 c& X$ G' U9 a8 |7 |  ^" @$ }3 u' f. U3 l
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! u; c- h; q& I+ D' \3 W2 @1 G9 b& i3 B% w) J8 o* {6 F" b7 |
__________________________________________________________________________: ?3 v- h+ F* U

) }! [% ]! [0 {! c% }, |  @9 G* C
- T  T3 w, i+ @% y: c; u$ sMethod 14
, n0 {. V) ^4 {* i/ C- o  S=========( P  P% A2 v& k, R& X

! x* {$ N7 s# H. G- QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ e5 p; ?" n7 e9 a2 H" y/ C
is to determines whether a debugger is running on your system (ring0 only).
: [+ H) t4 d# H. _. m$ a, ^# m: k# l/ w# Y% I
   VMMCall Test_Debug_Installed4 p& y9 ?3 l8 `) E1 Q5 q7 n/ D9 O5 S
   je      not_installed+ [$ Z& C7 x8 `6 X

6 K4 A' E3 K( A: H( E  C4 [  }" eThis service just checks a flag.; Y; H4 ~+ l: f9 y/ a( X/ @/ u
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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