About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) J& f/ F7 @; g3 T6 @
<TBODY>
! d5 z9 A* i7 o9 O6 U4 x) X<TR>0 N$ ]1 ]; a# X. J- [$ F
<TD><PRE>Method 01 2 Q- C& k% N3 u1 C+ b+ L! z
=========
8 O. T) _. D3 r: X% i2 L
2 P. p/ V# P6 t9 FThis method of detection of SoftICE (as well as the following one) is9 W( Z( ~- ]! ~
used by the majority of packers/encryptors found on Internet.
- Z: K$ b/ o% |) ?! y9 E' k' }0 xIt seeks the signature of BoundsChecker in SoftICE
0 E4 \; I( f4 t& T% G: d; N) }+ O
4 a3 m8 W4 Z6 u+ f    mov     ebp, 04243484Bh        ; 'BCHK'0 i" n4 }, ?& y
    mov     ax, 04h% d, y5 g7 o% D( q0 ]4 A7 A  S5 O( n
    int     3      
0 L! O0 w* [) v: \' M2 A$ D    cmp     al,4- @6 l5 [( t% O, P, u
    jnz     SoftICE_Detected
& i% Y( _  D, ]+ T, [8 J+ i6 t( X3 m) h9 A1 d" ]
___________________________________________________________________________1 L+ @0 e0 K5 o8 @( i
" S' V5 @2 J3 E! B5 X' J
Method 02
% q7 o5 w/ e; Y$ {: O=========0 U0 n' u' e1 @/ N# b1 Z! d7 N

6 @6 D5 C1 y' u& ~$ {4 U+ GStill a method very much used (perhaps the most frequent one).  It is used8 `/ Y0 u( K* |; O' ]" j/ a2 {
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 Q! F/ |5 C2 x4 tor execute SoftICE commands...
, m( k9 m+ I4 E. MIt is also used to crash SoftICE and to force it to execute any commands
$ I5 H+ U. P7 a# k(HBOOT...) :-((  + q6 C& Y3 \0 ?

/ |+ B* p2 F6 q- Z2 Q3 HHere is a quick description:4 `% J5 G. C. {) k9 z0 C& O
-AX = 0910h   (Display string in SIce windows)
& D6 u- h: R6 @3 g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! B" c$ n' S. H2 c& @-AX = 0912h   (Get breakpoint infos)/ X. l  n4 N' ^: B
-AX = 0913h   (Set Sice breakpoints)
; R+ m) v7 a7 X2 q-AX = 0914h   (Remove SIce breakoints)
, ?! a, ?9 y. @4 y2 G4 ]3 @0 W7 @' b- e- F! M& b1 m3 `
Each time you'll meet this trick, you'll see:
' E! V% E! m! K7 E-SI = 4647h
, \6 p$ |& l$ }8 O- b4 e0 `7 D( F-DI = 4A4Dh3 {: e5 B2 ]# c
Which are the 'magic values' used by SoftIce.
* l  v( m! j/ w; \1 aFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 f5 P2 u1 ^  f5 q# S

: T6 m- `$ G5 kHere is one example from the file "Haspinst.exe" which is the dongle HASP1 e9 [9 g4 r8 J
Envelope utility use to protect DOS applications:2 x8 U+ M5 m2 k, y
0 W5 W' g( Q8 Q, ]# `! x# S& H
9 i5 n. Z" `8 H2 c2 N1 \  W5 U
4C19:0095   MOV    AX,0911  ; execute command.' J1 M* R3 U' ~' M
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* f6 {2 X* a  x) N3 k
4C19:009A   MOV    SI,4647  ; 1st magic value.
7 z: @5 H+ I2 A1 L! n5 C4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: B; f5 W6 w! G
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
" d% L) P' m& i& ]4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute6 o. Y3 L& c" M7 \
4C19:00A4   INC    CX: r, V6 p$ z/ W2 S. Y# R8 p2 y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 ^5 l2 ]( e( s8 x  y/ z5 E' P
4C19:00A8   JB     0095     ; 6 different commands.
. |. G9 t( ~8 W9 C& u4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' `2 n! |9 T* [' d, P
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 f$ `  g# x0 W* h4 a, i
, h' e* |3 x. d" p3 U7 S
The program will execute 6 different SIce commands located at ds:dx, which
8 H3 u4 U8 l  z" l# H; hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 K' }- c  m1 L1 c, P' @5 s
: A. {- a$ Q1 f6 e
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, T* ]* n0 |( {% V$ r___________________________________________________________________________
  v& n) B/ R2 @( K( c# N- _7 H4 R+ ~, x( u3 i( Q$ x9 {
4 |* Q4 q- N1 y0 v
Method 03# [  k1 L: P3 a% \
=========
  A! V# [% P4 ?" f: D, R9 L' w3 k; X9 I7 k
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h" k2 G" _; B7 E& m4 v; k3 w
(API Get entry point)
# q( P8 ?. P4 U6 I+ W9 W        * a9 V: H! R* _( j
: F. \2 h- m: j0 e- o
    xor     di,di
# t7 F( D1 B# _% L( G# E! K0 c    mov     es,di
: ?5 @: j( L1 k    mov     ax, 1684h       . _" z! ]# Y" Z2 e
    mov     bx, 0202h       ; VxD ID of winice
# O/ A9 Z$ P  h( b    int     2Fh9 C0 m8 I. Z3 [1 i4 ~! G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 a! i- j; |! a2 Z4 h& m) J    add     ax, di
/ _, J& U2 ]  t7 j+ x% W    test    ax,ax9 C0 ?- a+ _8 h" g' X, P# N
    jnz     SoftICE_Detected
: ?) g* A1 g7 _9 C2 W# z8 M! y6 d7 s, ?3 R3 ~9 n4 }
___________________________________________________________________________/ ?) a" e3 B  v% O- ?- a

- B. Y4 m2 @7 J' L$ R# QMethod 047 t3 J" G( T* O6 W# T
=========$ }2 ^" G" k/ j" i9 P
8 g0 j+ E+ D# m7 M- W: o
Method identical to the preceding one except that it seeks the ID of SoftICE
* J+ c' i+ X8 v% q  Q! G) uGFX VxD.6 D5 n/ ]$ d4 K( ]
& F% B1 f7 f  C6 s8 d* F3 {
    xor     di,di
/ ?8 e* h% J) Y6 q0 i/ \; y    mov     es,di3 i% d0 v, M  I5 S  ^
    mov     ax, 1684h      
9 I0 [. K# B3 i3 \. b( R1 y  Q8 ]    mov     bx, 7a5Fh       ; VxD ID of SIWVID& k; B) l' U/ S' [/ g' d
    int     2fh
$ _  k$ q7 \% x! u7 S& W& P9 F6 M    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 z5 o. X) n5 x: B: C% p1 X7 A    add     ax, di& o8 H: ^% t; h8 t& n$ {# x2 a
    test    ax,ax
+ h6 ~8 {. x" m" i0 ~" I: `% G    jnz     SoftICE_Detected
; `, l& U5 H% ^( {- u' L& n3 `* n2 Q% R- _7 J
__________________________________________________________________________7 I1 t, i  u8 a$ P( j7 X
4 m1 W9 L1 b* R4 O

: K2 ?7 m7 R% Q" }5 f2 `) v- hMethod 05
) n) k+ u3 W" d6 r5 c  ~/ w7 M=========
6 O' P5 }9 f8 h3 Y3 ^' j' q* `7 V+ Q' ?2 }- p* J
Method seeking the 'magic number' 0F386h returned (in ax) by all system
9 g  q) M5 y4 e4 f1 \debugger. It calls the int 41h, function 4Fh." D* q0 y" u0 O* `
There are several alternatives.  
, F& U$ J6 b$ x% Z$ l* v* n
1 `" w# a, i6 n& b" H$ TThe following one is the simplest:
2 z2 i8 i, b3 t2 O6 D0 n0 n8 g5 P  e: x
    mov     ax,4fh' W  @2 m! ~( V& n4 c
    int     41h% J/ O- _& I* w% y# n6 B
    cmp     ax, 0F386
- T# o- Q' e/ m8 h    jz      SoftICE_detected
1 N: g, [, e8 }* \0 R- }
# [) T0 I2 G0 r9 v# k0 H
" D' v! ~0 w; F, m& eNext method as well as the following one are 2 examples from Stone's + m% [" U% \. u: O: P/ h# i
"stn-wid.zip" (www.cracking.net):- x8 i/ M# }% Q( W3 }9 {9 m
. M- L1 S1 A0 a/ X! }+ ~& A
    mov     bx, cs5 H2 }9 A! c1 K6 `- F
    lea     dx, int41handler2
. Q5 z) Q+ J" e' F$ W& Y9 Y    xchg    dx, es:[41h*4]; ?& T  |. Z) |. b& P) U. k
    xchg    bx, es:[41h*4+2]5 T) S5 J3 e! _  B5 v+ F& z
    mov     ax,4fh& p' e( }& `( u2 y7 ]0 x+ |
    int     41h9 D, D+ @- f9 U7 f) E% {# p7 F
    xchg    dx, es:[41h*4]
. r  o: s4 F3 O+ q: \$ N. ]    xchg    bx, es:[41h*4+2]. x% ]: B! [% I6 w
    cmp     ax, 0f386h% t6 ?1 Y8 ~6 E$ j. P- z5 P
    jz      SoftICE_detected/ J) e4 u4 p/ B; n- g8 G" ?
6 m* }" U. p2 L* t# [6 C8 ]
int41handler2 PROC
9 D4 D; y2 K2 ?5 O! ^    iret. D! Q9 Q' R2 C6 b3 `
int41handler2 ENDP
4 e, r7 Z# W/ m- i! Q$ n( L1 U" l- M5 \6 W1 G! r! K1 W. Q

) M# T+ w" i6 A5 Y% K_________________________________________________________________________
0 `, p5 S+ G1 J; d4 m* h+ F9 w
) @, V2 e' e/ |+ m, _" e* O( Z1 l
Method 06
) ~9 k2 ]' b4 ^6 S1 J# p' H' d=========- K8 u2 e2 X% Z

, }( J, m2 h( A7 e2 [2 N: l  A) Y0 E- ]' ]; j
2nd method similar to the preceding one but more difficult to detect:
* s" H3 `5 l7 C3 E
9 ]! @* _$ U" A9 Y, y4 \1 \; U* n2 q4 p3 n( _% Y
int41handler PROC9 x" `7 P/ p: R( }% \( h1 s! c/ i
    mov     cl,al
" C1 [2 g' v) B" |    iret  P( ~, I8 ~- m
int41handler ENDP
/ T$ ~! ?5 d2 H2 `6 n8 Q  Z
. {6 D) z2 {  {
: n% M; o3 x0 M8 J, V" K* ?    xor     ax,ax2 f2 X6 _4 R% A% p2 r$ B& a' Y
    mov     es,ax: I2 E1 U6 K2 K' T* X) k
    mov     bx, cs
+ ~: l' f7 d% l6 l  p5 ?  i    lea     dx, int41handler5 c$ P! A, ~2 \
    xchg    dx, es:[41h*4]
; z2 G, }/ i. D* W0 q# F) X1 D    xchg    bx, es:[41h*4+2]: V! ^2 k* `& a9 C2 `
    in      al, 40h* w8 X, a2 M2 q( d
    xor     cx,cx
2 u; D3 S; L$ {! S8 R    int     41h3 }, c- E, b3 k/ {6 D% C- I
    xchg    dx, es:[41h*4]
5 l! @5 I. n$ N$ }2 Q5 p) u7 u    xchg    bx, es:[41h*4+2]
4 b/ r0 C# T/ ^    cmp     cl,al* @) M0 j& ]/ U. P$ }! @( h
    jnz     SoftICE_detected4 s# t; Y# O' @* d% @
8 n( b% B3 T$ a, `) j
_________________________________________________________________________
; v9 h' h- X2 L6 K" l6 t: A( @7 h* c5 J% {' r4 n3 l
Method 07
+ Y. D0 j+ H; c: }=========
; I4 X( i5 ?8 w8 ^+ J
5 g7 z5 d" h9 ~Method of detection of the WinICE handler in the int68h (V86)! E  s& C: p, Q0 X$ t  }
/ K8 y+ _0 j* s  y; H6 P! V# {
    mov     ah,43h7 ~+ o9 C# D1 @
    int     68h
: t, q) ]8 z, W* ?6 u    cmp     ax,0F386h: i4 N% s" j* A0 q! |
    jz      SoftICE_Detected3 t. L/ |# E6 S# A1 z

4 R: [0 a( }" ~$ h9 J+ q. n0 D- @) b1 @
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& ?5 Q2 [1 S5 b# I+ d$ w   app like this:
0 @5 F+ S. [: G. H+ @. u8 q9 H  v+ U$ w! S) a! r
   BPX exec_int if ax==68
: X8 I9 _+ A$ h1 O   (function called is located at byte ptr [ebp+1Dh] and client eip is* x  I+ r* v1 r3 }/ B( l& W5 R
   located at [ebp+48h] for 32Bit apps)2 k' h" ~1 D- ^' g
__________________________________________________________________________
" T7 U- k( p; h& [) F- L' _
4 d5 @3 ~  W# P9 h5 n" N4 l8 J# O( L' `5 j: o. v
Method 088 O9 ?1 d$ |5 X& N1 d7 m# K; Y
=========0 J7 T) K7 j" w4 s

3 J/ m5 T0 f* [  D* G, d$ MIt is not a method of detection of SoftICE but a possibility to crash the
% {0 P+ _) n1 k+ d  n/ ksystem by intercepting int 01h and int 03h and redirecting them to another
- \' z# [" u. ^, K# I3 N2 o; @routine.8 D, @8 X) E" [4 V- P. ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
5 f1 b7 x; P1 Hto the new routine to execute (hangs computer...)9 b+ i4 J% H2 c- R8 h

) ]( s" ~! r- F* m6 H    mov     ah, 25h
$ |; e* y( Y. b    mov     al, Int_Number (01h or 03h)
- p8 i% Y; ^* a# z5 @$ o" m    mov     dx, offset New_Int_Routine
- E6 j& t0 c# X2 N    int     21h
. B1 F2 R0 m( Z9 A- A: n% d/ C8 V, n2 `1 m1 f1 N/ N. u( z
__________________________________________________________________________' q. c; i" n4 o$ i# y+ w

7 _" X) D. ^* o3 T, r4 k/ H+ HMethod 092 t# X4 `# i% G% {
=========
1 S- ^5 E6 B: g& d) N
% Q, X/ }3 `0 b9 E3 h* s- n/ BThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only4 S' N7 d5 S. l6 M- a
performed in ring0 (VxD or a ring3 app using the VxdCall).
0 e$ O7 p  Q$ R6 G% @. n$ RThe Get_DDB service is used to determine whether or not a VxD is installed" F* m. p% j/ }  `9 s) K
for the specified device and returns a Device Description Block (in ecx) for
; c" S7 `9 r' Q# `- ]) }that device if it is installed.7 L  `7 z0 X$ K

. K% L- ~. K; v# h9 _2 I  H   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
. ]) x, H0 C# G/ I" q4 H. F' J6 l   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 }$ q# H' e# S$ _
   VMMCall Get_DDB1 y% L- j& [  |- [$ ^
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 G" f( B$ f9 J* X. j7 u) z
3 O8 g7 Y/ d; \9 ^, VNote as well that you can easily detect this method with SoftICE:; {6 w/ m. e% o) U/ G" O0 [
   bpx Get_DDB if ax==0202 || ax==7a5fh2 o3 H+ m( j: \

, [; d; @- r2 D4 D__________________________________________________________________________9 K8 ?/ v. p; Y
5 M& _4 a+ v" i
Method 10+ a7 S7 g) x% I; l- m
=========) q, X$ T: l! \: v. E4 b/ \& B

4 b, k  \0 A) E. b2 y) v  Q1 n  G=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! A0 c/ W, s! G
  SoftICE while the option is enable!!
. R. R2 W8 o' |( Y: t  @& O: i7 O% v1 ?! g7 C
This trick is very efficient:
& c. c7 B. s& d! e" A* Y9 l- kby checking the Debug Registers, you can detect if SoftICE is loaded# D# \- ]/ `4 v! i5 a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. k1 R( Y; d9 A# I% _there are some memory breakpoints set (dr0 to dr3) simply by reading their. Q4 c" Z  i- \
value (in ring0 only). Values can be manipulated and or changed as well/ I! {$ A! z' _; h2 V3 P
(clearing BPMs for instance)
! S: c5 u! l5 h/ s! ^4 G! o1 U( D2 k3 Z2 m% C
__________________________________________________________________________
6 A! n  V  q" ]9 U
/ D; y  X- P* N% n" LMethod 11
7 f! K/ i3 J$ y9 u+ Y) \=========
9 p# z6 d  m- K% i$ N- q7 a; }7 I
This method is most known as 'MeltICE' because it has been freely distributed# B# s1 E4 s9 D0 \! r$ |
via www.winfiles.com. However it was first used by NuMega people to allow, n$ F. X0 n: T
Symbol Loader to check if SoftICE was active or not (the code is located! O# q! i7 V1 d8 g
inside nmtrans.dll).
1 k5 @, h4 M# @% k
) i7 h3 W7 E# q- D  Q9 x0 VThe way it works is very simple:- V7 o5 Y: h  G& M, D# m" b8 s
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 z& `2 b( v) g$ a5 u' ?1 b
WinNT) with the CreateFileA API.
  _- x, L6 e8 |3 z( L
$ p; D. c9 ]+ zHere is a sample (checking for 'SICE'):
* n6 U) t% E& c4 U: g3 ^9 ^
0 N, Q5 w$ @! t# d' BBOOL IsSoftIce95Loaded()3 t7 S! `0 b( S9 n5 m
{4 e. o; M& O2 d  z6 N7 W- @0 u
   HANDLE hFile;  1 d, D9 r+ ~) q% E/ a3 ?7 n% Z
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* m) z0 e) [: k8 F% D                      FILE_SHARE_READ | FILE_SHARE_WRITE,% y' k( t6 w% D  E( N/ h. m. ?
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);# P5 O6 H3 ?4 j3 g0 v6 w$ B1 B- @
   if( hFile != INVALID_HANDLE_VALUE )
# l8 X9 a7 j/ Z5 P1 G$ m/ S   {% q1 K% u6 t; x2 h* e5 ?' _+ q
      CloseHandle(hFile);: U; E) w% x; M
      return TRUE;
4 N1 X; O% T1 D' ~   }, D8 E; T$ o  ^: e( u7 r
   return FALSE;# o8 H7 _4 f/ y  U# Z
}* {( f: P; x: {9 W
- s/ e7 S8 y# B3 [6 k
Although this trick calls the CreateFileA function, don't even expect to be
: U, N- y, q1 Q$ Y; jable to intercept it by installing a IFS hook: it will not work, no way!% D' W; i! {/ b& I7 i1 W: m; J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
3 J8 @* Z/ ^( [service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
7 S# p4 a1 k) H+ W' r  H9 }8 tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
" a7 S$ _5 z* L! i; Rfield." K2 v3 ?# t" t" I3 e& N8 ~" Z
In fact, its purpose is not to load/unload VxDs but only to send a
3 F4 B& A3 v+ S. H" _W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 K3 U' \& T  B2 C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& Z. \; u$ [& T8 |: K8 O
to load/unload a non-dynamically loadable driver such as SoftICE ;-).. O$ E: ]6 X7 |6 `! R! \- ^
If the VxD is loaded, it will always clear eax and the Carry flag to allow% o1 \+ C0 z% t3 i
its handle to be opened and then, will be detected.
9 ?8 d9 f4 K% |: }" I2 WYou can check that simply by hooking Winice.exe control proc entry point
5 H) [: l. @: p; kwhile running MeltICE.
3 G. {+ p" ?7 ]2 M
4 ~6 B& _8 [8 m
" `3 I7 }- F- w$ Q/ \  00401067:  push      00402025    ; \\.\SICE
: g6 Y1 n1 S/ R8 z/ b  0040106C:  call      CreateFileA: n3 P& c/ e; A
  00401071:  cmp       eax,-001
7 \8 X" M3 v7 u" L; n8 R+ E  00401074:  je        00401091
2 ?% ~$ h" n% Q5 [* x, _- S* T7 {3 V7 A/ K9 |
5 S8 K- D" V. D$ g7 v# T& _4 q5 ~
There could be hundreds of BPX you could use to detect this trick.
- E: r- r. @& r% Z-The most classical one is:
, c- o% \- \: Q! b6 }) |  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||' g2 ]( K# T' v: A3 ~
    *(esp-&gt;4+4)=='NTIC'
+ _) y. m8 R! R0 L: u
; P: ?; R4 v8 p/ w7 ?# {-The most exotic ones (could be very slooooow :-(: E/ H+ ~' G" t" a
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; s6 i( n' e, `  \; @1 e
     ;will break 3 times :-(
( v" B4 R4 f# z/ w7 b! ^
) ]* X% t6 L' ]9 c, h7 e+ L8 s-or (a bit) faster:
0 A% q; S: o2 b% A+ i- K5 i   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
$ b- r/ g% g* k1 t" a$ N4 S/ x2 C
: I- z$ K1 T; [   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" L7 c1 p  s1 m. ^7 X9 R/ I- J, M     ;will break 3 times :-(
- @" _- W4 i! U% q
7 e2 I7 _" j  ^; [7 f1 C-Much faster:
0 ]/ }+ [0 L7 j5 ~6 M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 f" f6 l: Y! }. e+ u/ ?4 L
) V0 K2 V6 `1 E# u+ oNote also that some programs (like AZPR3.00) use de old 16-bit _lopen$ b) z! K) k5 ?) @4 Y
function to do the same job:+ ]& V! m& }. }2 N  [+ P

2 |$ }2 z/ V' y( P   push    00                        ; OF_READ
1 U" E5 W- }" R) M! y8 W8 s   mov     eax,[00656634]            ; '\\.\SICE',0: R9 y& D5 ?. C0 W) y
   push    eax) g, o0 m( y; p$ U) d( R
   call    KERNEL32!_lopen- ]* X- l  p) c/ V
   inc     eax
, x  p: p" g. q   jnz     00650589                  ; detected
8 P1 Z9 [8 ?& s6 n) `# @) K   push    00                        ; OF_READ4 D9 D2 L7 E  D" P; S
   mov     eax,[00656638]            ; '\\.\SICE'
% F# v# H0 X% j/ P) {3 A9 R   push    eax
3 B0 b+ O3 Y0 `' f5 {& w8 H   call    KERNEL32!_lopen. _( J5 ~% |6 o. R# b1 w
   inc     eax
8 P! M4 M! Q. w9 R# V; @1 t3 t   jz      006505ae                  ; not detected
2 ?% E0 I8 ]" N) ]2 }" p8 Y7 u4 d, T5 p" v3 w

" i+ R, v0 V8 V7 ^; _; B  u__________________________________________________________________________
$ L! J* H4 F4 l% u" S
1 B* C- U- `4 d( P, f; VMethod 12
: D3 c+ j0 D: s7 ~( T* b" J=========
2 W7 n4 ~+ J" J8 Y( M  }& p. A/ K8 l$ w; a( k: w
This trick is similar to int41h/4fh Debugger installation check (code 05
- R: ~' k# g' n+ D' H& O* C! M+ \&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- }* B% d, R) M$ sas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 U6 \, ^/ ]1 D1 F" Q& J# x1 c) J" w" o8 ]
   push  0000004fh         ; function 4fh  |" E7 Y1 L7 j# u* F% O5 X2 D
   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 O2 [1 X) @' ?/ y& N, b2 G: T                           ; low word specifies which service
% I3 q- |8 x0 P8 ^( d6 O                             (VWIN32_Int41Dispatch)
8 s, L/ I. X' p5 D- g  d( O9 k4 l   call  Kernel32!ORD_001  ; VxdCall
; J- t8 O( j% o   cmp   ax, 0f386h        ; magic number returned by system debuggers
! i. k, e: s) t4 t$ i; s8 t' a' x   jz    SoftICE_detected5 Z! s' s8 w& y( `# Y

0 R& ~7 Z0 j+ I1 {Here again, several ways to detect it:
# F  T" R  C- T
6 F8 l6 z. b9 f  ^    BPINT 41 if ax==4f3 Z; J9 m( B0 s8 \; i1 Y4 ^- P! ?

: J& I& _2 y+ E; M4 [, Q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one) @* m7 Z2 k% o: T

1 O0 j3 H  T( b/ N  G4 p8 J    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* a  C' M# x& _* L, h
3 |7 j9 ^  X" j7 b5 x7 N( ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 k5 u1 I! o5 j; k% J

  C3 L2 ~; ?; n5 g__________________________________________________________________________
' s% X- G; Z3 A/ B- e, k+ t9 e0 D  O# y2 @3 ]+ o" C
Method 13$ Q9 E, N1 I9 F% Z) w4 f% u2 U: z
=========, ^2 d& ]* Z4 e+ Q" \9 o. b

7 p, b* z7 \  w3 m' ~: G* wNot a real method of detection, but a good way to know if SoftICE is
9 O* y$ g6 M, Rinstalled on a computer and to locate its installation directory.
* `/ A8 X% X) n/ E8 FIt is used by few softs which access the following registry keys (usually #2) :
0 a  c9 p% i$ C) M# o) `
8 U: p3 ~4 I8 J' u6 S) g-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 u3 c1 I8 H9 r5 G: P
\Uninstall\SoftICE" {4 u* A0 O7 ^3 x4 z  J0 x, F, g
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE* n! y+ x5 U# Q  I. B5 l" a: ]
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 D+ c; b& o  j6 Z& r
\App Paths\Loader32.Exe
- l/ t, Z6 O8 `( I* A  X+ c4 h4 m, X
  L, q( e6 P: p$ P& c
Note that some nasty apps could then erase all files from SoftICE directory
9 u+ d* {" d. x' {; o' X(I faced that once :-(5 I' L5 X4 x; H( ]& L; Y

! @) i* E+ f1 H& o+ J9 cUseful breakpoint to detect it:" O# z4 t2 K. z  w% l
$ _8 B- K. y: e4 @2 s: y
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% X1 t8 @! O9 V; Q
# B8 `. R- _: {7 Q& {
__________________________________________________________________________
: m+ H: H1 ?; u0 I) l6 v4 [7 t4 \2 f# m& e7 ~4 t

( [& k) r8 v7 z' d0 n9 b- K# h0 V( fMethod 14 ) A" n+ |/ k/ f; v) Z6 p
=========
" E  V3 T0 {0 E, J+ A; |, n- N" {5 s- F* j& n/ f3 z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 z* ?! j: U3 T7 V! ois to determines whether a debugger is running on your system (ring0 only).6 ~5 C5 w6 r: n% }. x1 J
9 w! O( y4 G4 T" S! u0 L
   VMMCall Test_Debug_Installed
9 |6 e9 P2 A$ D0 ?6 Y4 _) b   je      not_installed% c6 I) A2 K) f7 J: G
! W2 s6 L. `; f/ C, H% Z/ o
This service just checks a flag.
5 P5 |- X* H8 \/ L0 J! m( F( R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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