About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>( R: U/ l2 d  G7 O, B5 N9 ^
<TBODY>
% T* L/ x7 O2 W# r4 B# R<TR>$ G, O  e' j3 U- Y( I9 ~2 U
<TD><PRE>Method 01 0 ?! W/ N5 _# C; u- S4 U
=========0 T. n$ W9 x8 ^" ?" o( [/ u
' e! O- e. ~2 K- d" q
This method of detection of SoftICE (as well as the following one) is" h. k9 @* n* }3 G: I) s
used by the majority of packers/encryptors found on Internet.
0 O" i6 B) a0 q/ U0 wIt seeks the signature of BoundsChecker in SoftICE( w  ?! a& f( {! M; y
/ o" `' A1 [3 F6 p; h
    mov     ebp, 04243484Bh        ; 'BCHK'* u' _% j% D0 P- B
    mov     ax, 04h
/ G; Z2 Z9 {1 v; G( T: G    int     3      
  S0 K5 ]4 V( M9 s) Y$ n8 I    cmp     al,4
' Y; V. o" J) r    jnz     SoftICE_Detected
# U9 z5 K2 N/ y7 x. X/ f* [9 B$ \
+ T  [& \; k8 j  R___________________________________________________________________________
! b% n% n! Y3 C* b' V6 S- m# L" }( E3 {; {* q
Method 02
6 _: T- v3 z/ f- L- [* g. v& K=========
9 K3 Y' Z* c; J7 D! f
: A7 t! m" }9 }# d+ D6 bStill a method very much used (perhaps the most frequent one).  It is used
$ Z7 t# j4 h& N6 f; P% Uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 x& H$ ~4 K8 J6 w# H- x+ }
or execute SoftICE commands...
' Z0 {& e; K/ J) [It is also used to crash SoftICE and to force it to execute any commands
6 ^- o9 Q; q: h. p(HBOOT...) :-((  
& O1 s* L% @+ c( @' T- a: s; y7 {% d) V2 x0 I3 H' v  ^
Here is a quick description:
# M- Q1 p9 y+ Z( D-AX = 0910h   (Display string in SIce windows)- s1 F: u, `2 i- _  M& L( ^, K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)/ h9 `, N. W% u+ u% M; {
-AX = 0912h   (Get breakpoint infos)- P0 ^5 z9 O9 W# _% W
-AX = 0913h   (Set Sice breakpoints)3 B. H5 M( J: V4 ^* g& C4 m% E
-AX = 0914h   (Remove SIce breakoints)
. ^+ o) p1 a9 S  G2 `# {* g% [; C9 D& r
Each time you'll meet this trick, you'll see:8 `4 \' w' s* O+ q$ T. j% }
-SI = 4647h* R8 ]3 t7 z' m) d5 S0 L
-DI = 4A4Dh# L8 i0 n0 E5 j0 P+ R) ~
Which are the 'magic values' used by SoftIce." p9 h' j& h! E* t
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 ^* ?. P! `7 w$ N( p; m  B1 o) j5 v& X. w, K' q; o: q: W% z) X
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, S' c3 b) p( [, _Envelope utility use to protect DOS applications:
, x+ J8 |5 D/ o2 ^+ O5 H/ s  c
# |0 g" x" t$ m) z& [
, f4 n! U/ L4 _/ a0 U4C19:0095   MOV    AX,0911  ; execute command.
4 o9 H2 s6 o0 L: v) |4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. ^0 f5 x) ?. W  ?+ t" o" p' p1 E* [$ x4C19:009A   MOV    SI,4647  ; 1st magic value., @3 R6 ^, d% S
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  f$ m2 _) b' [! x0 w: c
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% o( f- U' U: @  G) n/ ?) B4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: h2 q( A5 i  `5 A% P4 o% M8 {4C19:00A4   INC    CX
/ c! X1 d& Y+ t" t5 v4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" M  l: d; p% A  N4C19:00A8   JB     0095     ; 6 different commands.
0 ^2 X, F0 x% [" e. k4C19:00AA   JMP    0002     ; Bad_Guy jmp back.$ k" p; J( R0 B
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ @  g4 X" g$ ]# Q" S) B# j8 U
# o2 c, Q. g6 G2 F! e5 J, ~  I$ I, yThe program will execute 6 different SIce commands located at ds:dx, which) w0 N7 ]. @9 z6 ?+ C
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT./ i) Y: Y9 s1 d
  ?  C5 w; k, n8 M) G1 p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! w4 J& G1 g# E) k3 i
___________________________________________________________________________8 ~7 i6 x" f' ]+ P$ N

3 P  O5 R+ j$ d- X& U5 M
# D0 W  m' n- H. C2 U- y* q/ i+ cMethod 03
1 G4 K8 R' |3 J, e=========) h2 L$ [( T& g8 L8 r

4 Z; I, i- @; K& ~5 ?Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 P+ W: U3 g8 X5 r(API Get entry point)
. _& o. m. P, I$ M3 E& ~        ' Y. G4 j0 n+ P; k9 |' a
' z  B7 P- G' C. r: C, y
    xor     di,di# i9 m2 k$ p- G
    mov     es,di
3 C( H+ u! ?$ n- n' w+ o+ k, \    mov     ax, 1684h      
/ P) L& s$ _6 H  B) o" O    mov     bx, 0202h       ; VxD ID of winice
) o& l8 n* h" M' Z+ X    int     2Fh
( J) }- L9 g5 }' ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point' K  @6 v# p/ W& c! M3 ?* |1 O6 [
    add     ax, di0 H3 `0 u& T. s. b: G! c
    test    ax,ax
1 |- i' x  h! k( C( B    jnz     SoftICE_Detected
9 @" Z4 V9 [: J! ]- f% A) G9 u; N4 j: y
___________________________________________________________________________* f7 b( d9 h. Q2 Q! ^

2 v& @/ A: [0 _3 H0 t, }Method 043 A1 a1 y& q5 Z  x4 C6 Q( Q
=========5 R' X7 [4 i% n4 S- j3 Z5 X0 Y% x

8 Q. U  L2 a$ L; uMethod identical to the preceding one except that it seeks the ID of SoftICE
0 d1 a: E8 u% O8 ]9 KGFX VxD.) V/ ?8 z9 n6 w$ i/ `
8 w3 S6 k5 Q; U& t! S, C
    xor     di,di
4 U7 M0 p$ c( ~2 B    mov     es,di$ e3 _' K" \7 M6 ?. V
    mov     ax, 1684h      
% C7 z  m  j& P" u8 p    mov     bx, 7a5Fh       ; VxD ID of SIWVID" p! d) s5 I& g) x8 b/ n! e# X1 `
    int     2fh+ ]) k* y, [0 B8 g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
5 }+ _6 R& {" o3 O* A3 R    add     ax, di
# Z: n8 }" I9 Z1 R* |    test    ax,ax
, o+ x4 o+ T- \5 ^1 p# M$ m1 @8 ~5 v    jnz     SoftICE_Detected
- t, C3 R* F1 Q9 Q1 r# C0 a- W
0 u# p% A3 T( Z% U__________________________________________________________________________# u9 j$ n" f+ @" K

9 M  P" S, x1 f5 Z: s. P' g% s/ ~3 z5 E' l  Q
Method 05
* X  b5 \$ W8 X1 }/ h=========
: F. K0 g" D- a+ u
- U! q8 M- ?2 i5 X5 ^" B- Z' |Method seeking the 'magic number' 0F386h returned (in ax) by all system
  O. d+ G4 t) f/ @% a% G- ?( \* Hdebugger. It calls the int 41h, function 4Fh.
* }  _; x! ?; t* C' s" [. R8 qThere are several alternatives.  9 [* K1 p8 S/ x: W
/ P1 w: l3 T3 Q0 e
The following one is the simplest:
+ Y: j/ O. W1 m; R& r$ @- N+ N! o$ G9 n/ _
    mov     ax,4fh
" k6 n' u4 I1 L! R& e7 B& T9 l    int     41h
) V8 |. j" p: C; v/ J) [7 D    cmp     ax, 0F386, d1 t& S7 P' W4 R5 H7 o
    jz      SoftICE_detected
9 Y0 c5 \/ t8 d) n8 x& z9 o5 j' @' J- ^1 \$ Q& b
. [$ {5 z6 {- d8 J
Next method as well as the following one are 2 examples from Stone's $ U  I4 l; }/ y" t9 z- |
"stn-wid.zip" (www.cracking.net):
# Q/ q5 X; x6 F5 m' @" H+ w/ @
, h* T  U( W& U# C& i* A/ @) N7 Q    mov     bx, cs5 Z3 {5 `2 a& Z5 ^2 f1 h
    lea     dx, int41handler2) ~, |! W& U: H" O5 V8 y
    xchg    dx, es:[41h*4]
! \/ ?$ ]' ?, d* G! Q+ [    xchg    bx, es:[41h*4+2]0 a# t0 p( `! S
    mov     ax,4fh% w+ [; M8 I2 s8 G) E
    int     41h- D# C. Y- J. g( e
    xchg    dx, es:[41h*4]0 j8 _3 N) x" R' I" w5 ^. }* n
    xchg    bx, es:[41h*4+2]7 R/ y2 G; J; B: s# d" ]
    cmp     ax, 0f386h
. }& C8 S. ]+ t) D    jz      SoftICE_detected
! U* M' e$ y5 h7 L1 d2 i# F5 E0 K& v; D
int41handler2 PROC
5 W5 W4 K8 P% g1 y: ^/ q    iret$ l: `$ J; p& d% ]
int41handler2 ENDP
% E) \" P- P: @. N, ?0 ?& e# \" M0 d' \# m; y. ~1 x  a3 e2 }: J
7 u; u% U  a/ p2 _
_________________________________________________________________________1 t1 N8 n" A+ f5 o/ H" k6 s) h# U
# ?& S5 H4 P- J% ]: H8 i& E- `0 E
& j4 {6 h9 P  e. N9 J" }/ z5 O& L
Method 06( Z7 i# g1 t! ^, }  l3 C6 G( w
=========
/ B! z- i. p& \6 L6 l
. Q$ n- s: g% v8 P/ t
# L' g9 ]1 b5 D5 L1 f2nd method similar to the preceding one but more difficult to detect:9 `0 S% V5 H  h7 m7 }; W

5 \. m, m# i8 S
& x2 w! p7 y1 w5 O7 q6 eint41handler PROC
' @8 x" W) L( `: M3 T7 C    mov     cl,al+ I. O& G2 c# k; u" S1 X2 j3 p
    iret! j3 A. L' `3 F+ e" A
int41handler ENDP6 q5 M3 ?% L: B6 q, l' h, u
2 r; J! n$ O; ?2 c+ R% B
& J  W5 [2 V/ h
    xor     ax,ax
& t. y0 n# ?- `7 ]    mov     es,ax
+ e& b* e) |0 h5 {& I0 f: X    mov     bx, cs
% z, P( e& Y9 e9 N4 A    lea     dx, int41handler
" Q5 @$ O7 x) l' s4 }    xchg    dx, es:[41h*4]* I  G/ \) ^8 w9 @
    xchg    bx, es:[41h*4+2]
, X) h: T# c6 S7 q    in      al, 40h3 q2 p  D5 g  _( W9 D
    xor     cx,cx% a0 J$ }6 r" }5 e
    int     41h5 a: l; d+ [* D0 R: `- ]% M
    xchg    dx, es:[41h*4]' c! M. I& S4 `, ], f/ _! L9 H5 j
    xchg    bx, es:[41h*4+2]
" n5 J- X) d: J# r; b" j2 C    cmp     cl,al
4 ^9 i& o+ y3 O; x# q    jnz     SoftICE_detected+ x1 k0 t( A, t* [
# v; Y7 \, t# d) i
_________________________________________________________________________( m) [( `; G- _; Z& q6 L3 U

. r, N5 o  r# D/ V3 _Method 07
9 |# o$ N' w' K6 a/ I' C+ ?$ {=========
7 T/ O# R6 i) c1 |9 D3 ?. `" A, S* J3 ~* h
Method of detection of the WinICE handler in the int68h (V86)7 n$ a$ Z$ [7 |( @/ P

* a- Z: T  [9 R    mov     ah,43h
, E7 ^) F/ V0 k  Q    int     68h7 }* A! D! i0 C/ I3 u' q
    cmp     ax,0F386h# p- n7 i- q9 h4 ?
    jz      SoftICE_Detected) k; ?2 @3 d: H# K9 M, |8 p" y+ P# P
& E1 \; v8 I. s+ w6 }6 g' c' ^& ?

) }* @6 _' g* V" w=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
0 m0 j- x6 S; D4 Q; G% |   app like this:
  d+ Q6 ?. s4 }# ]
% `2 T& g: k7 d7 K   BPX exec_int if ax==68
/ q' B; o7 i$ B   (function called is located at byte ptr [ebp+1Dh] and client eip is7 n6 f- c+ p2 b" Y* Q8 |
   located at [ebp+48h] for 32Bit apps)  K: S6 s2 `  T
__________________________________________________________________________9 x6 q; k5 X$ b* Y2 W) B
: [$ n7 T' G/ {6 T7 A" V5 R9 p, f6 m) R

' ~( _" a5 d# G* L- f3 uMethod 08
9 \9 U2 C- B" `5 z=========/ G( {! O* @1 V

) X% p% K5 e; p. T' C. s9 JIt is not a method of detection of SoftICE but a possibility to crash the
3 w+ U' u0 M  P- nsystem by intercepting int 01h and int 03h and redirecting them to another
) @) N7 M, m; hroutine.. H" g2 B& V: P& m8 y+ ?5 D" ^9 l" W4 g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! P$ K7 k7 P! F7 uto the new routine to execute (hangs computer...)8 Z& u1 s7 N1 J/ K7 ~9 _
3 h- E- D2 R1 o, J* f' f
    mov     ah, 25h" D+ b  n4 C) a  f" C% _: @/ [1 \
    mov     al, Int_Number (01h or 03h)7 J2 j$ B, U3 p8 p
    mov     dx, offset New_Int_Routine
; e4 o  `  K# W  o) R  M! c: l    int     21h
% U. j, X: F% i
5 {& E5 v. {% C5 c. }__________________________________________________________________________! M* C+ R2 l  f# N

% R$ D& n0 c( c/ gMethod 09
% ^* J$ F0 r- `5 N: ?9 j0 N7 ]=========
: a7 S5 p$ d/ ~: {
$ Z! c9 |: C' q( T2 {0 d! t3 G- LThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
7 }% L! g# a( l% D9 y9 ^performed in ring0 (VxD or a ring3 app using the VxdCall).
1 X+ K: l! _6 XThe Get_DDB service is used to determine whether or not a VxD is installed
; b1 |# v+ _2 R- H  P1 F+ Ffor the specified device and returns a Device Description Block (in ecx) for6 z0 ~$ H- Q* l- u" h
that device if it is installed.4 W4 S& K, d7 K+ Q

" |+ Z  a# G& p0 w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 s$ P, b' n/ n2 ?   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 @" f% D7 J% I2 O0 B6 Q0 ^
   VMMCall Get_DDB
$ u* i: X( e; B   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% |( P" z; I. G$ _- b8 E- r, R3 L9 q, b
, f' ^6 ]5 y6 `" v, r1 u
Note as well that you can easily detect this method with SoftICE:( ^' c2 j% T+ v
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ J  ~3 ^8 h1 l( ?4 b, M
1 \; A: N, B- J1 I3 w__________________________________________________________________________( ?# _; S, o* n% L

" G2 b% s3 y) @Method 103 H7 C( o0 ^- g4 L- y, ^
=========
) z6 l0 r# T4 F+ U' _) f( z9 ?& I1 b) q: s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ I' {0 {: Q1 J& P1 _  SoftICE while the option is enable!!% z. c. R6 }6 X9 f2 U

# \( T0 {9 |$ w: J: @5 U  i4 ~This trick is very efficient:
  }! {& o' I& n( b# N9 Nby checking the Debug Registers, you can detect if SoftICE is loaded. H+ X; b8 H; ]0 H  K- i/ K8 G
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ b. s, u( `0 M1 W8 C- r' ?4 B1 f6 ]
there are some memory breakpoints set (dr0 to dr3) simply by reading their# X! i2 i. E  d$ K
value (in ring0 only). Values can be manipulated and or changed as well
9 I$ n/ [$ a, Z% }: @% ]2 [(clearing BPMs for instance); L& M+ @/ {! C$ L! [4 f
; }' ^1 _) f7 |, v4 v( g# M# B2 O
__________________________________________________________________________
% |# N# Y9 l1 k5 P, s+ y0 I' o, i( ^5 O& l# D
Method 11* H& U( n4 r7 R
=========
$ O* T5 s. J: I3 e  i% }
: g# {" ~9 h0 ?9 c3 cThis method is most known as 'MeltICE' because it has been freely distributed
9 i$ y: R: m1 B3 F$ n' c" s$ d& Vvia www.winfiles.com. However it was first used by NuMega people to allow
+ x* t. Q/ ^5 ~! iSymbol Loader to check if SoftICE was active or not (the code is located! L$ u7 D. Y2 Q$ `
inside nmtrans.dll).
" R/ l7 l, A7 E1 g6 D$ Y
8 Z7 D7 M* S2 [- zThe way it works is very simple:9 ]( R* H/ m5 u* X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
9 \( L$ k" c, }1 ^$ bWinNT) with the CreateFileA API.
, F: G" Y# E) ~0 `" A/ O, W' c" e/ }
* M  J( n$ g- U5 `6 y6 Z9 @7 zHere is a sample (checking for 'SICE'):' _8 U" \7 \3 A3 i' j2 c6 p

& S/ w1 m, L* d2 j2 |BOOL IsSoftIce95Loaded()  f  G. d; C4 \) i# S& h' c
{
1 O2 w& d/ e1 Z( ?  m* Q   HANDLE hFile;  
* u) E! r" g6 s* T; G   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# q( Y2 \' u3 U$ V1 M! u                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& ^2 x3 {  N6 A. a                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 o, g$ S& F' f7 U) G- O% a/ F
   if( hFile != INVALID_HANDLE_VALUE )5 i' P% W& |+ q# L# V) q! k
   {
8 L& V  X3 }: w      CloseHandle(hFile);
$ A! o  n5 R8 A: U% o4 _      return TRUE;, s8 j; j2 U- ]2 i6 r+ w
   }: K( M4 Z; V! ]+ R
   return FALSE;
- k# V( \& A2 G7 A' L}
2 u5 F3 N  O& n7 I. E" ^6 b% H7 x! g* d! J: u4 b- V1 n
Although this trick calls the CreateFileA function, don't even expect to be  C$ {8 z7 q% x7 M* Q3 {6 }. ?
able to intercept it by installing a IFS hook: it will not work, no way!4 K7 A9 `3 [: O. P, e
In fact, after the call to CreateFileA it will get through VWIN32 0x001F( p4 a9 k! L" `5 N( O2 V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 h: O- o; n2 v6 P! sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 @$ ]( R3 a0 i- [" V8 _1 c! m6 [field.
9 ^8 [& k- a8 a" N2 {In fact, its purpose is not to load/unload VxDs but only to send a
5 t/ Y" r1 F% ^- c1 VW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)' c, i- Z8 \* c$ F  z8 r* C
to the VxD Control_Dispatch proc (how the hell a shareware soft could try: O6 U" O! T. V2 U
to load/unload a non-dynamically loadable driver such as SoftICE ;-).9 ]% f3 B  l" i) E
If the VxD is loaded, it will always clear eax and the Carry flag to allow5 K5 r% y' L' Q0 k" l! ^/ f
its handle to be opened and then, will be detected.& Q+ m6 b! w0 X  n: d
You can check that simply by hooking Winice.exe control proc entry point
, w0 N  ~6 p" |# ^8 S0 q- ?while running MeltICE.
& N$ o( N8 O# b, t8 U/ R2 j' Q3 `) _5 C! z) ~, ?
' B6 s! y0 r# G! b
  00401067:  push      00402025    ; \\.\SICE
. E: M: F% J. h6 d- p' j) L  0040106C:  call      CreateFileA
$ S& R+ `: ?8 Q' L  00401071:  cmp       eax,-001
, r+ }3 j/ ?" z4 h, [& n  00401074:  je        00401091* O& ~, P: H" D0 Q
) N, }! @1 g( P. g5 h8 Z
7 t* E, d1 z# m
There could be hundreds of BPX you could use to detect this trick.3 H  H" g7 Z/ B7 z1 n2 L  g
-The most classical one is:0 H5 r) y: z5 s) p3 a" v- B5 i
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ \, v9 h1 i7 f* G2 B2 c  X9 q    *(esp-&gt;4+4)=='NTIC'1 p$ ?4 `( l; s* C, X
* E$ S" G3 _' z1 w5 G
-The most exotic ones (could be very slooooow :-(3 c& g. a0 r. ~
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. I! q# M7 x& E- P' j  m     ;will break 3 times :-(
* F6 K( e" b* f. t. Y) |* T# S7 {8 ~
6 ]; J3 Z9 \6 W4 A-or (a bit) faster: $ K. t. Q. u) Q- I  W5 s
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 _. T" |" N6 J7 m3 z
$ }6 {2 o7 y0 ~+ G  l   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 I# n% x7 c2 U* M* D& r: V     ;will break 3 times :-(
7 A9 r" E  P( }+ N! N. o# V
& E3 M1 P4 \, Q2 S; a! z2 x# f-Much faster:( C4 b) a8 i1 _3 F
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 l4 e) U5 N$ r4 w; A" ?

( w! a; p# L; {8 ~- sNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
* P, R; E! c3 C: pfunction to do the same job:& r. r2 [  _* \( y* f6 G6 x
) P5 U! G  [* ^6 e: C$ Y2 D
   push    00                        ; OF_READ
5 }- Z. D9 [' v( t7 `% i. r0 s   mov     eax,[00656634]            ; '\\.\SICE',0
/ J) ]( f; B; Z, y1 }, w. F   push    eax; F% N( ]8 D! R! O3 Y3 d
   call    KERNEL32!_lopen% l: z1 i: c; h  x! r
   inc     eax# S. J! J# W/ y; A" H/ f" A
   jnz     00650589                  ; detected0 E! M- L$ K4 @4 T( k) {  N! G
   push    00                        ; OF_READ2 w+ B) u5 @5 s* {5 v) J; Y
   mov     eax,[00656638]            ; '\\.\SICE'
: C2 ?6 R* v/ S# L9 z7 @2 d& ]   push    eax
7 q, _) `7 X6 D0 _) `   call    KERNEL32!_lopen
  C6 k; p% K  a+ f9 X3 m   inc     eax" e- Y+ C4 G, Q1 M3 Z
   jz      006505ae                  ; not detected
/ t1 n: U8 j+ E6 |- b% A. @
" u3 E' H6 I+ K6 E/ ?1 v2 S1 G
& Y) _6 Y4 P+ U& G1 Y__________________________________________________________________________
4 {! L; A7 l* I9 ?# Z  v8 h/ _* C. n  b7 C
Method 12
3 d0 {" r* L. {' d. x% F" Y=========
1 T5 `2 |9 G5 e+ Q9 e% X1 a
+ D/ j9 [3 f$ U. W" ~7 P" TThis trick is similar to int41h/4fh Debugger installation check (code 05  T: W7 b- g+ t0 m/ k  G* x
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. N* F6 a# Z$ W& h2 b; n5 |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" z- w7 a; w7 w- W/ B" o+ {0 T# B8 X$ t
   push  0000004fh         ; function 4fh
6 Z: Q1 H; n& J" v  ^( W4 ]0 B   push  002a002ah         ; high word specifies which VxD (VWIN32)
% S4 A' w4 k0 ]- v8 e* Q: U                           ; low word specifies which service
8 ]$ l6 d& o; C8 I- c                             (VWIN32_Int41Dispatch)
% [! a& z9 r0 ?# p: z   call  Kernel32!ORD_001  ; VxdCall
/ |4 a4 i, @9 O4 I; o: {* x   cmp   ax, 0f386h        ; magic number returned by system debuggers) x' b/ ^* a1 l/ Z  O
   jz    SoftICE_detected
. v. M' ^6 A6 o5 w1 x; R) P9 X( p5 \! w+ M" \
Here again, several ways to detect it:
% Q$ J; H& \# [9 ]& S8 b
9 Q* _  O( j  _, w0 Z    BPINT 41 if ax==4f
1 Z: X6 m$ {9 K) }1 j
" X1 {+ _2 w+ M- ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, J( R4 s% o( b* x& p- S# y9 J7 o  D$ Q! h& \/ H
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ W; Q% U$ t: I4 Z9 }! e5 J  i3 ~$ o( o7 n4 ?3 y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!8 O+ X8 i& G1 ?" [# ?% _* y$ z
& K& e& y; O. s- W. t7 X
__________________________________________________________________________  N% g  N5 A3 f; @6 I" H1 v

0 }, d: Y( [9 q& x0 IMethod 132 S1 u$ J! I# A0 P
=========
  Y/ L4 G  n! @. E6 Y
5 H0 M0 _+ \+ N' [9 B! U  O& z* D& F, w! rNot a real method of detection, but a good way to know if SoftICE is& @% G& T; K) D) S
installed on a computer and to locate its installation directory.
1 ], Y. ?  {# u& c. h7 UIt is used by few softs which access the following registry keys (usually #2) :, n; F! R+ k0 R* t3 u, |
6 o& S# b6 }/ E  M: z
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% A: s; w; L' s
\Uninstall\SoftICE" N$ W  a) t; w9 ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 m: L  B5 w( g+ u  [. E-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" M; w0 e2 V0 G, D0 f( j
\App Paths\Loader32.Exe
6 Z6 h' u0 N- k0 b
2 R4 \3 c/ z) t, N" ^& C4 u1 _2 ]7 `. }" u
Note that some nasty apps could then erase all files from SoftICE directory! U; a6 I) w$ a) i; p2 i: u% Q) v/ Q
(I faced that once :-(
6 L7 u/ o: b3 Y( {7 l& a8 t
' Y" ]) k6 u+ M0 n/ G  SUseful breakpoint to detect it:' D+ F9 ^' l3 ~  K
8 \& V5 E1 {3 d2 s9 n- {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ p2 z5 Q9 a, m' F2 u/ W
9 `8 R2 x1 r9 L/ N; n: v: n
__________________________________________________________________________
- U& Z/ b) x' R8 F" A3 B" \& K+ l; `4 |# r

. z+ p3 f& x7 _# l* w4 Z4 eMethod 14
8 J( U2 W* s; f  ]6 u. B=========$ U  x& R! [- s" N

! J5 q( b6 S1 K  QA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose& m  Q' u' `) Q4 A, Z4 g2 x6 \
is to determines whether a debugger is running on your system (ring0 only).
8 \$ @1 n* c8 F1 ?/ E9 [- x2 f& y7 j) B
   VMMCall Test_Debug_Installed. r) i+ h8 ?3 D  X' ?. [
   je      not_installed! d8 C7 u0 q) Q. w$ ]3 q# P9 n. b1 O
4 ^; v0 }6 L  c+ b& l
This service just checks a flag.  Z1 n9 t( S0 Y. J
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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