About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; l5 D7 ?  @  c# ~/ ]6 j+ i<TBODY>6 y) c( A9 ?. H/ v* ^6 m; O- j" p
<TR>
) f& p. C/ Z0 i<TD><PRE>Method 01 9 [( A" B) _9 {- t- h
=========2 f% z1 |' d) p1 S* v2 u* q
. I( M/ S! V: y# ]3 K
This method of detection of SoftICE (as well as the following one) is/ W5 I. {( n; q+ @; P/ q, c, Y0 c
used by the majority of packers/encryptors found on Internet.
. c7 c2 _  A* M2 eIt seeks the signature of BoundsChecker in SoftICE! A2 e. }, k# w, M% ^
  K0 E5 \$ Q& }* V6 {% y; P
    mov     ebp, 04243484Bh        ; 'BCHK'
5 Y$ Q' l* P7 [) B    mov     ax, 04h
- V7 r. l& g5 V+ _/ x    int     3      
0 x4 A8 u  i! d4 t3 ^8 R0 _3 i    cmp     al,4
2 I  R" h8 P; C# h6 n    jnz     SoftICE_Detected8 [- F! x+ b) g( w5 T
+ `0 Q8 O) o9 q; t4 ~
___________________________________________________________________________
6 N' _# j9 S; I% Q7 J. ~  ]* z* D: b9 z; L6 J3 x, A" u' Y
Method 02/ |2 K, y' u% l2 b# Q
=========5 G" o4 Q! N" r4 n
0 S8 x; U5 K% n* J' [& J
Still a method very much used (perhaps the most frequent one).  It is used
4 \% Y0 I. M0 m) ], k( lto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 c& V+ B" I1 s$ b5 G. J7 _  x$ O
or execute SoftICE commands...) j6 D6 S2 w, o$ B0 S6 }5 G7 a! P
It is also used to crash SoftICE and to force it to execute any commands  P+ T% u  `" l* u9 B9 ]3 ]; ~7 Y
(HBOOT...) :-((    ^' T5 N' ~5 E) y2 ?0 Y5 @1 y* t" x1 _

4 F" `" B! T* }2 G" gHere is a quick description:
' |  I! x3 a0 z' m2 g% r-AX = 0910h   (Display string in SIce windows)
  S7 ?# H. o7 @5 s0 m" f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  t0 }( Q) x! ]( L5 L: J1 P( f
-AX = 0912h   (Get breakpoint infos)
/ w& w3 B2 c/ O) C/ T-AX = 0913h   (Set Sice breakpoints)
3 Y; F0 H* ?/ \+ ]& d- b-AX = 0914h   (Remove SIce breakoints)" J/ j; w) J* Q6 S2 @4 A

; i( |; k& h0 N% hEach time you'll meet this trick, you'll see:
( U+ l! {- e5 f-SI = 4647h  ?! Y. K% ^2 ~( W% b
-DI = 4A4Dh1 a  d: H  ^, E* C  X
Which are the 'magic values' used by SoftIce.
$ B: H4 `: i2 S: x+ H2 uFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.$ b% k8 C% Q  z3 H1 L- f
9 D9 K! i: ^! [( f1 B, ?
Here is one example from the file "Haspinst.exe" which is the dongle HASP# p) w7 l+ c: B8 R: t: P0 J
Envelope utility use to protect DOS applications:
. F; w3 R( W5 _, z
- x/ |" u' R; A! O# i. O- m! B) p4 g$ U8 F' ]
4C19:0095   MOV    AX,0911  ; execute command.
, R8 Z; w: F  v- B" Y* G4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* u# R$ l. y' k$ {4C19:009A   MOV    SI,4647  ; 1st magic value.
' q! M( \$ k' G7 y" R0 \4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 u% L5 |0 Z* t
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 h6 h: Q/ I1 l' D& J' f! T
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 k+ W8 T9 P) g2 j" m. P4C19:00A4   INC    CX5 v) |8 a9 }# U
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
/ |  C& l3 \. U+ e4 l5 q9 N. c4C19:00A8   JB     0095     ; 6 different commands.
) L0 U$ l8 [2 f9 Q. [% G" m4C19:00AA   JMP    0002     ; Bad_Guy jmp back.& D& m& W. B+ _$ z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 z5 \6 b: H9 }3 ]; x) a# X# P) x$ b8 |9 L) n5 K0 F$ P
The program will execute 6 different SIce commands located at ds:dx, which
0 e! P6 [0 Y; W! S1 ^. z) [are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., w/ M7 X* \' o' S7 e7 X+ T. ]/ K

! H) ?4 O5 i& M7 K& k3 u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.& Q& z9 M! m  R4 D) `9 c  D) {
___________________________________________________________________________
$ }( b, ^5 T. U7 s" O8 h+ C  l+ v! Y) X1 x; U2 E  K0 B* }
! x( q' u9 w3 P8 ?. d: J4 V
Method 03
8 F' J# f( z, X( M; g& `' w=========
  m1 A4 E, k0 y7 Z: T8 e7 }% z' }
/ v( J8 }  S7 M4 C5 v7 qLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 b, d8 F" m; J% W% R- T(API Get entry point)3 J! j. }3 |' K2 O4 o
        0 b7 x  v* o6 [9 a0 H; T5 `3 H
  Z% f/ B+ t  i* @* F# ]% A4 I
    xor     di,di  U  |, N& t" O9 Z
    mov     es,di4 }, w3 F$ k; U; ~; {3 R  c3 O
    mov     ax, 1684h      
& `. \+ {2 Q% M' G5 b3 H    mov     bx, 0202h       ; VxD ID of winice$ G' G7 |" x( Z7 g# R) X& U+ B
    int     2Fh& e, y1 ?8 a; z
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, Z7 ?, B2 g. F8 \; ?, d( f( p
    add     ax, di& q" q$ u' _: a3 ^) W% ]. [: E
    test    ax,ax: W8 T1 A0 R) x6 V) q
    jnz     SoftICE_Detected
3 \9 f. O6 E5 Q" W7 U! W0 P: `$ ^
___________________________________________________________________________8 K' u; c/ Q# v/ r% i
! p7 U7 Z' d. u% A2 Z. Q
Method 04
. S0 L2 }. M; `' X=========" d4 l7 v6 `, J% S

4 l; X! x5 N! l, N4 CMethod identical to the preceding one except that it seeks the ID of SoftICE
. H4 }/ f: ], X. g3 L0 r" WGFX VxD.6 S: B. V3 ]) H2 ^$ q2 n

' s. b6 x/ X3 h; G. K+ u7 X) c    xor     di,di
, y/ g$ Z2 L% P) ]. f* Z/ s8 P    mov     es,di7 K" S5 J7 U9 f' [) M" h3 Q
    mov     ax, 1684h      
% N0 o8 v" n0 F    mov     bx, 7a5Fh       ; VxD ID of SIWVID, m. ]1 `- @. }  m9 m8 ^3 G
    int     2fh
5 R$ F3 d0 d  g1 V0 Q+ M3 V" h    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ a! x' \* T. l) F$ r- y4 i4 O8 ?    add     ax, di. |* ]- U9 A( j$ S8 b8 p
    test    ax,ax
' v9 |+ ~4 a4 v+ |    jnz     SoftICE_Detected: O5 j, l( q( I; a
/ ^) h8 c- B0 l- h5 R" W! P! T% o/ F
__________________________________________________________________________" S" d% p9 X9 A# K
' \8 ]' \- l" u; Z3 N

: D( U; F& S6 K4 d( d4 T/ i8 f; P* JMethod 05
0 l& p1 K7 k3 w/ v1 u" B  \$ X=========
& m) \3 |' _) k  i, u
: D4 ?; m7 B/ @% h) r% s6 C( @Method seeking the 'magic number' 0F386h returned (in ax) by all system$ ~  J! V  J: {/ y
debugger. It calls the int 41h, function 4Fh.$ Q7 m# b( q9 t) p" v' C+ m) s
There are several alternatives.  8 i0 O2 o5 b6 V2 |$ i
& J3 D0 \4 i* I9 Q
The following one is the simplest:- _2 j6 c& M2 }! v
( E6 ?% C# q( x5 p" v4 L
    mov     ax,4fh
: ]# e/ p0 E& j    int     41h5 T# R, ]1 I2 c/ |
    cmp     ax, 0F386
$ E. Y, e! d7 y! r- z. m- P4 _    jz      SoftICE_detected7 ^. X- @* A' @# c! x# J) T5 J5 U
. X5 e1 y  Q$ l  j' a
6 {: k, j, b: O2 P& m5 v! \: {
Next method as well as the following one are 2 examples from Stone's ( [& P0 J& }# D
"stn-wid.zip" (www.cracking.net):5 f* |- N4 F+ k" j9 [, E

9 f2 {; |, e* g    mov     bx, cs
& @) ^0 U6 Y+ I; s  {2 o    lea     dx, int41handler2* Q; N( r7 D0 s: M, W/ ?
    xchg    dx, es:[41h*4]+ ^" I7 |+ B$ x) X/ N
    xchg    bx, es:[41h*4+2]$ t/ A: k% I$ O: H
    mov     ax,4fh
! |8 D, P: S# K    int     41h
! o- A6 r1 q2 J: U    xchg    dx, es:[41h*4]* s$ D' d- H, u0 l: ?! z2 H
    xchg    bx, es:[41h*4+2]6 D7 V8 P, F, @8 Y
    cmp     ax, 0f386h
) `; _. D6 h* b+ m7 U    jz      SoftICE_detected& g4 g: R- |+ U) A4 w) v' Q# K. w2 J

0 Y& f. O6 G8 g6 J, f% _% m- kint41handler2 PROC- z0 r  d7 u. d
    iret" _+ C) c1 u3 Q
int41handler2 ENDP
+ s; C3 a5 o1 d- V6 q  D, j
: |- G7 L6 n* }/ q1 K! k
, j: U9 B% x3 ?; Z' V& n3 l_________________________________________________________________________  M4 r2 L5 S/ c: g

6 X' K) u' `+ Y) @2 i+ V( z- x- {! Y9 m: s
Method 06
  G" `- J4 W  G- H=========# q3 j. k0 K2 s- E

* r/ a+ P' b3 I. l1 [% f' n6 b2 Y% g# W4 k
2nd method similar to the preceding one but more difficult to detect:
7 ?4 L& b: K" L" h7 g. n8 H) ^1 x( ^+ k2 i' i1 R% z

. E5 P3 [5 V' g* gint41handler PROC
' y- \/ e  v6 r; h" t9 y' f    mov     cl,al
1 t3 _1 S: P. k7 [  D2 t. S    iret2 I5 s" G& ^: `( ^5 d
int41handler ENDP$ R* ^" V! N5 |& s1 D% W
& i$ ^# X* s# T$ j

: E1 v) w( d/ z  D+ {: `    xor     ax,ax% ]$ a# k8 z# X
    mov     es,ax
9 P) e9 m9 |3 J! |0 s) u    mov     bx, cs
( E6 r6 {9 G" F& Q3 t    lea     dx, int41handler/ ?# `; k8 T0 W8 F8 O! E
    xchg    dx, es:[41h*4]
8 J( a* I6 i1 b& N    xchg    bx, es:[41h*4+2]  n8 L. E7 p, i* }
    in      al, 40h
+ w7 P  d0 D  R    xor     cx,cx
& S' J+ P3 L* n8 @* x, S) ]    int     41h, z. I' G# F: c. p+ T8 R
    xchg    dx, es:[41h*4]
  q; l& K9 o9 P# n' U    xchg    bx, es:[41h*4+2]. F$ y3 d: h8 ]' D4 w0 g+ j$ V
    cmp     cl,al
5 r. D1 S4 K0 {. Y    jnz     SoftICE_detected
6 M8 ^! l- }7 ^8 {
( c- I$ L0 C% z; J. I' q: @_________________________________________________________________________; r7 [' h: R6 f/ X2 B2 s% n  n

/ d$ j0 l  U6 d! e# i( NMethod 07% G+ q5 _5 x  I% }
=========
, h3 i" n4 @6 G9 R: y* ?0 M) T' }
7 c3 C! q8 E: O# [' D" OMethod of detection of the WinICE handler in the int68h (V86)
2 ^' [8 e: R, G: P
8 t, a. s/ u0 D* f# ~; [, A' t    mov     ah,43h
- @+ Z% I8 `  H1 {    int     68h# ^2 {+ i( B% }) H
    cmp     ax,0F386h: L# G6 ~+ U  o' _+ W9 w3 V
    jz      SoftICE_Detected6 B* t' j3 `, Q7 j
9 p1 U0 d: w: r1 @# s* r

8 @; L) g% w" e- u$ `/ q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) p( ?+ E; U! t. K- d   app like this:
6 z9 u# I2 R" R8 w& w$ T. Y
/ m8 Z- P! }& |+ d" I   BPX exec_int if ax==68
7 B% S1 O% n% B2 X4 j# e   (function called is located at byte ptr [ebp+1Dh] and client eip is$ R  I1 K+ Z; L. z
   located at [ebp+48h] for 32Bit apps)5 h9 k; S6 k" O  h& C
__________________________________________________________________________, ^' r+ ^5 _% u  z5 |) n
8 N7 U( [! x; x

. n5 ?( J* ]7 B- `1 W* Z/ gMethod 08; `' G$ J. @* Q5 K! o& |
=========; z5 ^+ P, P$ ~  J: ~2 k

( m$ L' Z! f; P! ]* w: p" SIt is not a method of detection of SoftICE but a possibility to crash the
/ v+ Z3 ^; I, Y( G. F& F+ b* Ksystem by intercepting int 01h and int 03h and redirecting them to another% i6 R- Z! X' M8 {
routine.1 L1 r' A% [3 L! s
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: K, H' R: [# e, `1 q( \' f5 P* F
to the new routine to execute (hangs computer...). {; _4 s4 M1 Q) A2 s6 f9 a" X

+ Z3 q  Y. @( H% `# B    mov     ah, 25h( L8 z' I/ n$ `4 @
    mov     al, Int_Number (01h or 03h)
- Q, U# \( [/ }9 o    mov     dx, offset New_Int_Routine2 c+ \! N  y3 h' N: u4 S
    int     21h& ]7 m2 z( R; s8 U8 W2 V
0 m# B1 w, C) P. s
__________________________________________________________________________$ @/ h8 b$ |. W4 n. C' t0 d
8 U$ a0 N% F) j4 d. ^) d
Method 09
- s# N: h  z# a' X6 ]=========
1 T$ ?+ N; \8 C6 ]. e9 v/ F/ F9 I  ~" p8 f
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 Z7 j8 U* i9 P0 }
performed in ring0 (VxD or a ring3 app using the VxdCall).  Q: e' i/ K* K$ ?/ Y3 O
The Get_DDB service is used to determine whether or not a VxD is installed# c' ?2 U# t" G
for the specified device and returns a Device Description Block (in ecx) for, V# i% L: Y1 i
that device if it is installed.- N- @2 \2 j/ r+ b1 v3 r! M$ I3 a( r2 ]
- d9 D% d, q5 N, x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
* [- s- w- Y' z# ~6 P   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" F) F  x) Q* \$ g5 _4 [- o4 Q
   VMMCall Get_DDB
  f8 B6 k  n. G( c   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
) e/ Q; o( A: i' B2 Q$ D" D' E' D
3 J4 W( Z/ p" ]# b# a' wNote as well that you can easily detect this method with SoftICE:% ~" g/ U  m6 X3 M
   bpx Get_DDB if ax==0202 || ax==7a5fh0 i3 I! v  W! B$ b
  j. O8 L- f/ g8 `! s1 A  S4 @
__________________________________________________________________________' `# A+ w6 U$ M
4 }3 E4 i2 Q; X5 v& i! B% p# X4 m
Method 109 k( T! l5 \% L1 K) Y9 Q7 H+ i
=========
9 M9 O: U  C, k/ ^
  v4 u% a0 C4 V6 d- r. B5 h2 Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ d% Z' ~* `3 O/ j) M. x" n
  SoftICE while the option is enable!!
. S' Y6 \4 ?7 B0 D' e1 o
+ R3 ~) y* l- b. |+ AThis trick is very efficient:
. H# Q* L: f. s( T. A& sby checking the Debug Registers, you can detect if SoftICE is loaded
: m' G% y+ e" H! U, y1 k(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if+ p8 o( g- ^- Z# e) o+ e
there are some memory breakpoints set (dr0 to dr3) simply by reading their% U$ W/ Y2 B4 j! \6 V/ y
value (in ring0 only). Values can be manipulated and or changed as well3 |/ w; i. ]" {) k. X
(clearing BPMs for instance)
' P  h3 o% V8 b8 {6 J. r  B/ n! H6 j' a7 |' e+ \1 Y& B: P; j) {
__________________________________________________________________________. n, a( J, {- c1 }1 G
" x5 H, s# I) X  P" r
Method 11
, N# d* w0 |' d' b& o0 l2 X- D=========
+ }. O+ b" I5 d/ y- }9 Y, p5 n5 J! q) I, A3 v- _7 |
This method is most known as 'MeltICE' because it has been freely distributed1 `/ v- o" g! s! d- A
via www.winfiles.com. However it was first used by NuMega people to allow
* A3 s! s( |  G, @Symbol Loader to check if SoftICE was active or not (the code is located
; d4 q  G3 a2 B' s* g2 A" t4 P) Cinside nmtrans.dll)." b- B+ s9 s8 Y% _# R6 |! n8 Q

8 }4 |) g/ Z& o; SThe way it works is very simple:
3 T& O; C, D/ I9 v$ FIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for( c+ x" f5 m  \6 c9 t: i
WinNT) with the CreateFileA API.
* T. q3 r( g, @3 f: Z: i2 ~/ K# v9 z8 c9 L
Here is a sample (checking for 'SICE'):, L1 g6 H- v! Y8 l

* R! j# ^' H6 ^: G. \% L" r! kBOOL IsSoftIce95Loaded()4 R7 B3 o) y( Y2 W3 V
{
, Q. F# R, A( _) l   HANDLE hFile;  5 L) R. D4 P2 U% y. j6 O/ ]3 m! Y
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& t- M  d2 b, v( n
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
6 H7 d; f# C, ?4 l% [7 ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 x- Y, C: }' k! ^8 l4 l   if( hFile != INVALID_HANDLE_VALUE )
& S. l& H- J# R" p. k2 \: Y  ^   {( i- ?* b  ?3 P% x3 Y3 y$ q
      CloseHandle(hFile);" p7 M2 g) u# R. U
      return TRUE;& _, U. y( c* _1 g- H' W
   }( v' F# ^, H5 A
   return FALSE;# O6 b4 s3 x2 Q6 ~/ F- A- K5 ]' c
}
* \( ^6 P$ s4 `! S; Z- E5 e+ R
7 V5 E5 @# |" f3 EAlthough this trick calls the CreateFileA function, don't even expect to be
* J( W7 e) x, p! G' mable to intercept it by installing a IFS hook: it will not work, no way!
8 A2 f  R0 v1 V5 _, t! RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
0 g6 W. M: h8 Jservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' B1 K$ @; A" ]; {4 E% oand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  e! y% I# w! D% P  Z. O/ u, ^field.! [: H/ b' h+ i0 F4 s# _$ p
In fact, its purpose is not to load/unload VxDs but only to send a
1 }7 U* X5 `. ]: v. V9 q6 n' RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) f* V7 v, c# f/ r9 I6 W5 k' Vto the VxD Control_Dispatch proc (how the hell a shareware soft could try2 _' J1 x" W' u* T6 Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# J5 y, i: f4 M  R2 J# hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 V- `; ~& s2 |+ ~its handle to be opened and then, will be detected., w, D' d1 |) X6 W. k! S
You can check that simply by hooking Winice.exe control proc entry point
1 `( }* M) e$ G" I' mwhile running MeltICE.
! R9 L% @; L6 c; H: v  B! h* y" G* U( k) u1 |
! i1 t( `9 V' }
  00401067:  push      00402025    ; \\.\SICE
0 i; g+ Y2 |6 o, i& o4 Q& {  0040106C:  call      CreateFileA6 |8 w' m# F1 P
  00401071:  cmp       eax,-001
' z) Q" g! f/ ?) m2 n. l6 T. d  00401074:  je        00401091
% n' e" H: m1 B' r, G$ f6 d  Y. a2 |) ^- T' S/ ~

! O: [( L, l9 ]0 N% D! CThere could be hundreds of BPX you could use to detect this trick./ p- t, O3 N/ u- Z( [
-The most classical one is:0 L6 O+ W- \3 z) P% b! z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" \+ c, H/ q- X: g9 D
    *(esp-&gt;4+4)=='NTIC'# ^& V) w! N- @2 z& Q

# I5 P, Z/ Z( K-The most exotic ones (could be very slooooow :-(6 K3 e; w8 Z; v: U9 K% a( K: m
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 L; K7 B0 ?/ U6 p5 b6 E     ;will break 3 times :-(
: `) @. \& w6 i4 t) a/ f3 E, G
-or (a bit) faster: 2 i& K$ h1 Q) c+ r+ g, Z7 b, ]
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 Q0 R- R3 E! A, G2 g
& p6 |4 D4 _, n/ x   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / A6 \) y4 u* m# V5 Y7 n& Y
     ;will break 3 times :-(9 f% u/ F" _2 H2 ?( b
6 A% ~" ~2 k9 ]7 \) m( M9 i
-Much faster:
, @' k, L* l+ M; j0 V: b5 K   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 X1 }8 @: V" i/ e% t4 g( m5 ^9 k
; }' p$ f3 m0 O; l: m) h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
7 n0 X  G3 W. @/ P  hfunction to do the same job:2 h6 O# V! i' u/ e

4 ~+ h: y0 c8 `% o   push    00                        ; OF_READ& A5 W; {: N  h; Q' _
   mov     eax,[00656634]            ; '\\.\SICE',0+ J) E3 ~3 f4 h
   push    eax8 ]; Q) {- W4 R; m5 s8 z3 S/ h+ y
   call    KERNEL32!_lopen
% y1 O% |/ Z/ M   inc     eax6 T: x8 t5 y2 K2 R3 v  G
   jnz     00650589                  ; detected5 E& G( p8 B( Q" j/ B' \
   push    00                        ; OF_READ
4 v/ U9 g5 u& P0 T4 M( e! S   mov     eax,[00656638]            ; '\\.\SICE') y! ?# f+ a' |& H
   push    eax: \0 N+ S, k7 J9 Z' G
   call    KERNEL32!_lopen4 h# d: s7 M, _" x
   inc     eax
& n7 t( @+ [% |# s" m& L. n4 U   jz      006505ae                  ; not detected% E7 a) U% g4 Q# ~9 L

) ~) J1 [4 L# B, Y2 @0 q* W* {! ~0 i1 z9 M
__________________________________________________________________________
, t) ]( I: q& `( ~4 A/ F+ o. ~4 A0 ~2 P6 d* V! B6 u$ x( k
Method 12. h* s8 q) `, R8 E4 Q2 _% {4 G
=========' T6 S4 T8 O+ |- Q& K* R

$ S3 p+ e. _! e3 CThis trick is similar to int41h/4fh Debugger installation check (code 05
7 J& m( @1 w$ T4 @0 T. b% q, ^. ]0 b&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& r, [. H3 Q6 G( D+ Jas it uses the VxDCall backdoor. This detection was found in Bleem Demo.' f, `( Y* @# V  y3 v2 _& l
' }3 h  U, @- a- W! F$ e
   push  0000004fh         ; function 4fh' C1 a9 c: Z- e; {& F+ Z
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ Z% D0 }: ^$ J9 u0 u
                           ; low word specifies which service
6 Y! q& w- Z# J5 V+ o& A4 |+ y% a                             (VWIN32_Int41Dispatch)
- l3 R0 N0 L$ g) Q: {6 S   call  Kernel32!ORD_001  ; VxdCall% r; }1 s7 g( J- I5 m1 ?# r
   cmp   ax, 0f386h        ; magic number returned by system debuggers
  w2 Z; k" N- \8 m( u) Z   jz    SoftICE_detected7 S7 l3 f1 D# f, ], J( i) u7 U

' w+ s8 C0 @) V, B3 b0 L0 O: K& ?' `Here again, several ways to detect it:
, [/ l; t0 c% m+ s
8 r3 {9 J; w( O4 L; O5 v" z; J1 Q    BPINT 41 if ax==4f
! u# x, a( x; ?- Z5 X! q1 T
! b$ G0 `0 y( Q0 U    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! n$ m( c: X  z; j' L" I) \, e7 y& W3 m2 H$ V
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 O! G4 p  q; F; v: n. s

3 F+ H- J& [% q7 y9 z: {    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!- L6 Z5 Y9 C1 M1 [

' s: V% I6 |" i; `8 G0 L__________________________________________________________________________5 R( Z) x9 w- l) X; i0 F+ P

' q8 |( i7 j1 q* gMethod 134 Z' V& v3 f3 I& G1 R% X: j
=========
4 ], n+ a* J! a% |  y1 U" I+ t$ u) `0 k6 {" V1 K4 D6 A; N
Not a real method of detection, but a good way to know if SoftICE is
8 Q% P+ A, G1 [1 J) g9 p) F# n( g4 cinstalled on a computer and to locate its installation directory.
, z$ N0 S/ P8 K$ D' nIt is used by few softs which access the following registry keys (usually #2) :
9 u  [6 W# T7 V% l8 j9 d& K
( V3 n4 o, ~6 i8 M-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* j: e, c; c) |5 j\Uninstall\SoftICE7 j3 @. x1 Y; ~( N' {1 J: A
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 Q" [4 k: L. S# R$ P" s8 {-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 M1 v' f' K) R' ~+ L
\App Paths\Loader32.Exe
2 [+ P  O0 [4 A# G5 s; U, @4 k) I$ R; G, d4 T

) T- F) F2 p$ b, ^- O% s8 UNote that some nasty apps could then erase all files from SoftICE directory
, t' @+ j# Q: b(I faced that once :-(
& r' z: y+ P; m6 B; |% z6 W% @# M" F- @4 f0 o+ P6 L
Useful breakpoint to detect it:
7 V% o6 R: ]: t* p: Q2 W0 u" P
+ s2 s- G" S; L$ I! K6 w2 W, b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 \# n. k/ A, T2 i8 \8 @
/ c2 t' _4 O  @; E9 }# @; t5 I1 e__________________________________________________________________________5 X7 a. j: L  s9 H$ w% S) `" j

, B( o2 b3 c8 r6 |1 ~8 d) U2 h7 G- w& X; m
Method 14 5 |" S& u; k) _. C5 ~# \$ X; L1 ]
=========2 @! U0 J, D8 H- k1 a+ |3 E' X
' x6 z$ @/ r% M1 C+ c/ j6 \1 ~
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ H" S+ w/ u! ^) {* pis to determines whether a debugger is running on your system (ring0 only).$ Z/ M) ~) U1 {  t: J! b2 B
, S+ l4 v% v( u2 L! S0 y. V; w
   VMMCall Test_Debug_Installed3 m$ c( N" J( Z0 l' S' R
   je      not_installed1 l3 g( L- h! t4 D( @7 x

# B+ ]5 @8 P! T8 e! y: M- IThis service just checks a flag." g, b- d% H( D' s, }; F# s# d$ U  X1 B
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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