About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>6 h: H+ A/ ]2 s  f+ z
<TBODY>
, s" K/ N0 E! {3 _* \<TR>/ @1 r' p4 z$ e* T2 u# D
<TD><PRE>Method 01 4 |" O8 q4 r7 o1 ?4 F
=========9 z5 d/ V- k# x& f  m, ~4 [9 u/ C( @
( v( ?$ [3 s0 v. Q8 b
This method of detection of SoftICE (as well as the following one) is
$ d( U& C  h% f2 D+ y; K9 X7 Rused by the majority of packers/encryptors found on Internet.# Q5 n& f2 `0 T7 z1 o
It seeks the signature of BoundsChecker in SoftICE: u9 k7 |3 G$ m9 U9 Q

5 P) y; }, I$ ]# |    mov     ebp, 04243484Bh        ; 'BCHK'
7 I6 ~. U) l' B7 |    mov     ax, 04h' S: ?* z2 Y( D1 A5 u, T
    int     3      
  D2 }1 D! M& }- w    cmp     al,4
$ m& k, q3 a5 @- [    jnz     SoftICE_Detected3 n# Z3 u4 _9 J! P

& _% f  h" m* X  r, G; [___________________________________________________________________________
/ F$ G# a, s5 p9 q; m3 [1 z3 h# _! j1 }& b1 a
Method 02
) @4 d1 L5 a5 o1 T+ E" B=========/ O8 c  u! L- M1 V" }& t. I

2 }- C9 g) F* L/ M3 p+ yStill a method very much used (perhaps the most frequent one).  It is used
  Q, o/ w4 m; U0 A/ H! w* tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 h. l/ c& m0 t
or execute SoftICE commands..." ~; r4 h8 h2 y' m  a
It is also used to crash SoftICE and to force it to execute any commands
. p. y2 N2 Z$ r0 p9 b. S" o(HBOOT...) :-((  
* O' ^* U* }- k# h9 ]  ]% g
+ f# u5 W& ^7 J% y8 LHere is a quick description:! x$ q  Q8 U; ^3 B4 u1 @. E
-AX = 0910h   (Display string in SIce windows)8 o9 o# Z  w' l9 ?  i3 j1 M: T
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( @* ^% }  Q" M: l-AX = 0912h   (Get breakpoint infos)
9 W5 n3 Y- f9 p* [  q-AX = 0913h   (Set Sice breakpoints)& ~% T1 |: V4 S( b4 F! V& N
-AX = 0914h   (Remove SIce breakoints)
3 }, i+ \! G1 Q! M: _( Q. o; y
' z+ J7 I! a$ P/ t6 ]Each time you'll meet this trick, you'll see:
0 x) C) D# C' S4 Q) g- Q-SI = 4647h
5 s' F8 \* R" Z; d-DI = 4A4Dh
- a  G9 y0 G7 r; N8 D! jWhich are the 'magic values' used by SoftIce.8 b5 Z+ n- s# ?8 o1 Y! D
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 \7 _( u9 w% u- f
/ g5 I# @" L, h3 k1 I  wHere is one example from the file "Haspinst.exe" which is the dongle HASP
2 s; F" E0 V0 b- }* d# b$ iEnvelope utility use to protect DOS applications:
$ d) p' J5 A4 U, @( m& \' G7 l0 f: H; n) D7 ?% x, L5 l; W
$ g3 g( ~, j/ ^1 t" f) P
4C19:0095   MOV    AX,0911  ; execute command.
9 x1 o  n( b6 R: V- d3 Z3 y4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) T' U  w4 {& o( g4 ^
4C19:009A   MOV    SI,4647  ; 1st magic value.& @6 @" e5 H) }5 V
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 _; g  B' N: l2 \+ r% {6 I" r6 Y) l
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% Q$ w3 k3 v* _: [
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 K+ B5 b2 w0 C  K7 e; R4C19:00A4   INC    CX
- K. u0 n5 ~; }6 J4 C- V4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% I: T$ n  M& ~  I1 r
4C19:00A8   JB     0095     ; 6 different commands.
( m0 K% m7 t. x4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 x; J* q- B3 [4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% V/ a  d: l! i5 @# t
5 J9 a, |2 u( A% j7 o: E9 l8 QThe program will execute 6 different SIce commands located at ds:dx, which
+ x: Y! _0 D% `  m) K. Care: LDT, IDT, GDT, TSS, RS, and ...HBOOT.! N  L) e+ V* \
& g5 ]2 g. V) }) m
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ v& m/ @, `& A0 V$ h1 _0 K$ S9 z
___________________________________________________________________________
; b/ [7 h% d$ m  y+ f8 o- P4 K: s! N2 V, i% F
6 m; [3 r; W6 H' m- ?- {! O
Method 03. z; t: ^, X/ d, u$ {) O) [9 ]8 g9 g( I
=========+ j! p% @# a4 A  [6 b3 C/ B

( W& G& Q7 `' ]2 PLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ x6 v" {# Q9 s/ j( @
(API Get entry point)* @/ s" h4 t" i' Y2 u
        
0 }; i0 l0 @5 S* b/ X' E/ O$ z: ]7 B4 V# N
    xor     di,di
2 c" p' Z1 ^* J) g" I1 Y& ]+ ]- u    mov     es,di
) Q, S6 g, C7 g; D) f6 p: j8 |    mov     ax, 1684h       7 @+ L3 [  Q$ X' d7 F" s  X# L
    mov     bx, 0202h       ; VxD ID of winice
9 E/ s1 {& n! s( ^2 j    int     2Fh. N3 v( _* k2 T  S& C# J) ?" k( G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! d. }9 ~1 K- a' _
    add     ax, di. A) p0 [0 H; r, k0 a; T* B& E
    test    ax,ax6 P! n( L) [) o, D6 J  C
    jnz     SoftICE_Detected
& C5 {% ]8 M: M$ U$ Z1 \3 }1 J& W$ s; i$ C
___________________________________________________________________________' V, s& c1 F) m# k% f/ A4 W2 u) F

* C* ~4 D  K& O3 C6 yMethod 04' f0 C/ ^5 _. z7 V
=========! s8 S' Z9 _0 B
6 h: i8 g: S* Z
Method identical to the preceding one except that it seeks the ID of SoftICE
7 T  L1 z, a' |) y5 e$ ]1 O8 YGFX VxD.  Q5 m& y+ i9 q

: ]4 U, b8 e3 b7 p4 g    xor     di,di5 W9 C- m$ H% u0 I$ h4 d+ H
    mov     es,di
  F2 ^; }, t) @5 H- C' g% X    mov     ax, 1684h      
3 Q( Z* M4 ~  T8 U6 m    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 Z4 {9 R5 S. k    int     2fh6 n4 Z8 l5 p2 |$ S7 F5 `" }# G4 W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% f1 t5 u, x( s8 @( y
    add     ax, di
3 C+ X5 K8 Q' ~: w2 v# T0 ^    test    ax,ax
$ x0 V7 h+ Q/ Z5 J* G    jnz     SoftICE_Detected
5 I. M: Q; I: K* N, T# H: G
  K1 {  Z: U7 E  L% e, v* e) a__________________________________________________________________________
; J5 j  m5 Q! Y5 l+ h" j$ D4 E+ s6 y) Q% y, D. q% f4 s. ?

1 X, O+ ~  T& B8 h1 J9 m5 WMethod 05& w9 S* e! x3 r2 c
=========6 }  |: a: p* ~6 D) Q
! w* }. |* s9 ~, Q' j3 j! M3 l
Method seeking the 'magic number' 0F386h returned (in ax) by all system
& N: T7 [3 Z2 rdebugger. It calls the int 41h, function 4Fh.( {$ M! k5 f: X2 [: k, k5 e
There are several alternatives.  - d( k2 M7 I8 F

) U" V/ @  Q; k* y! k! r' H+ \# wThe following one is the simplest:3 i6 N& H) t) y$ Q

! Y. y4 _; V9 w6 q5 t9 x5 ^7 _% x  o    mov     ax,4fh& X/ [4 r2 m9 _2 m  |1 o3 D3 d
    int     41h
; Z+ w7 v* n  Y2 `8 b, x, }# W    cmp     ax, 0F386
6 p7 v; m# i: w9 ~    jz      SoftICE_detected
2 ~- O; B( @- L: k) J7 U
% ?/ n9 O* d; a! E+ p! O, n3 J/ M2 `
Next method as well as the following one are 2 examples from Stone's ! C6 \' U/ z# U/ m9 {2 m* \' c
"stn-wid.zip" (www.cracking.net):/ Z8 @# }$ a- P& {5 @
4 Y/ c. T: x  a' p( u2 d
    mov     bx, cs3 |; D& Q2 L8 f2 ]$ r+ c1 J7 H; B
    lea     dx, int41handler21 y. y( a; j- ~; w) u
    xchg    dx, es:[41h*4]
; H! c$ f0 \) [( \! y0 H' n: f    xchg    bx, es:[41h*4+2]2 ?4 s. R/ m1 w. O# p+ O
    mov     ax,4fh
6 w  E) j( g% e0 p* Q5 \    int     41h) U  {0 a6 A: v$ M) T- ], S  w' q& ~
    xchg    dx, es:[41h*4]
' v% v9 I* N& O9 h' [- D    xchg    bx, es:[41h*4+2]% S! t1 L% D0 l
    cmp     ax, 0f386h( o( y  Z- L5 Y6 h" g, }- x
    jz      SoftICE_detected- K5 m6 `  p- q' c, P7 W
% z% v$ i  C1 n2 b( J( ~3 J
int41handler2 PROC
& I0 }3 O) M# l! }, g. z- J    iret
% w+ M, ]( C- A; Vint41handler2 ENDP
0 T: X' x- s, F+ b
( c: J2 y+ C; b1 @9 r* r3 R' a& F6 |& X. v
_________________________________________________________________________9 @* c( ~' k$ I) ]8 x! v* Q0 P

6 Z6 @! g" \$ @: a
( h" Y& K! I) _- V" C# rMethod 060 R- W# Q$ _" e3 q! p
=========* S8 \+ G( h7 j* P, s
# G3 Q4 Z- W( h- I& C
, j1 N: i5 |2 b8 |
2nd method similar to the preceding one but more difficult to detect:
1 R5 b7 e5 f/ Q1 J6 [" Z4 M7 h9 Q/ P" A  D, J, A
1 ?( X" i- }6 a5 J+ c2 F& V$ \
int41handler PROC
# ]0 u; c) s+ j& i" U' j    mov     cl,al
$ j1 B5 ]& U5 e0 `6 g2 b6 a9 d/ s    iret
4 J- A' S( P: z! ^% B0 Oint41handler ENDP: ^1 U1 D$ O9 w! T" O

+ b! s9 A  u, [$ z3 i/ M/ E
+ h+ X4 x( q  X+ A8 S0 g    xor     ax,ax
4 |- l4 {  @% }% f    mov     es,ax
: H& A* G: O1 _& j9 E3 {    mov     bx, cs
% Q6 t- u3 W7 v2 l; P) ]3 v    lea     dx, int41handler
" E* `. h9 ?6 E6 q* j" J    xchg    dx, es:[41h*4]  _0 |, B9 W+ a" ~0 w. |
    xchg    bx, es:[41h*4+2]
! D0 V. v/ O4 N; p2 ^( \    in      al, 40h
" A, b9 L2 @7 w# ^0 f6 T; W& [    xor     cx,cx
. ]: I, j9 @) Q' d    int     41h
1 _, W! i& t! E) S' E, m    xchg    dx, es:[41h*4]
! h2 Q7 F" ~6 O% d( h: H    xchg    bx, es:[41h*4+2]
7 Z" ~8 A! S1 m9 `- U    cmp     cl,al. }" I2 o6 K. [1 ~) g. y
    jnz     SoftICE_detected6 ~' n7 t; O. {
3 V8 [0 {9 \( S% T+ @) p. N
_________________________________________________________________________
7 q! x& n5 V, N: ?0 q4 L2 B! _( M( A' Y8 m; |6 e
Method 07
! F. O# X% ~) p( u=========+ c! n1 I" D9 L6 @. D( F6 z4 d
! [& F2 ?7 n! q" ]* Z2 T* a
Method of detection of the WinICE handler in the int68h (V86)( u5 j- R2 l! W# @
+ L5 t* q0 Y( ~" p
    mov     ah,43h
9 `+ o2 B$ J1 a. K, ?    int     68h
* _/ I# f( j5 l8 j, p! Z    cmp     ax,0F386h6 u% [4 f: V/ `: s4 U: s0 t
    jz      SoftICE_Detected
' S# \$ u# v2 N; ~% v# ^: B: z, ]2 [9 K5 o* F, h5 W
; q+ @* Y# a3 h" |  y+ B9 c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit! Q3 V% @+ n& W: ~
   app like this:" j5 G" o. V% K* e
2 f3 @4 E* A5 L% r
   BPX exec_int if ax==68
& q, ~/ W# g: }5 }! x; d" {   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ _: D6 g( Z  e3 ?4 G   located at [ebp+48h] for 32Bit apps)
  }0 ^4 z. F( Q  Y  j( i) |; j__________________________________________________________________________" o, F& ~+ T0 r6 l. {4 Y* ]
" ^; H2 O2 N. ~1 o$ P! W

6 c) n% ]4 m* P' f+ Q( m- h. ]Method 08
9 Q; S; l" F) ~8 k$ X=========
; N- o5 w2 d' K9 Z9 Q0 e! A4 g. R! r. p+ p  W" m; I
It is not a method of detection of SoftICE but a possibility to crash the
, v& |0 R  `4 r" B$ r8 M& k% gsystem by intercepting int 01h and int 03h and redirecting them to another5 c4 Y+ C* @" j6 N; c, N. g! `
routine.
  k; L7 ^& O  OIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points7 b) z% ~' ]- f3 L( `% u7 e
to the new routine to execute (hangs computer...)
. n8 t3 ?0 Q2 {" M( Q% w' y: j  E8 q' p2 G* m
    mov     ah, 25h$ \2 L9 S$ ]0 E( D0 X8 a! M
    mov     al, Int_Number (01h or 03h)
+ {" o1 J# E/ n3 ?% C7 ^    mov     dx, offset New_Int_Routine+ }0 g/ g% R/ B( x5 p8 O
    int     21h
7 x- O" V. o$ p/ J: B+ c2 Y
' q9 E0 E% j6 c! i8 ]; G: C  e__________________________________________________________________________
  H5 z5 h9 ?+ A2 O7 W- C( K. L+ ]6 N$ N. W: G' X2 @$ J/ f
Method 09
  j. `% A  V0 I- l( Y# R=========: m' m& g  N/ C5 a. T. g
" @% u  F& u- t; q  [& w
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, A% u! M6 k, {: G# s  z* m
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 ]; Z5 S0 B  H! X8 U. kThe Get_DDB service is used to determine whether or not a VxD is installed& K) k1 F/ D: b+ R
for the specified device and returns a Device Description Block (in ecx) for
* g8 j! h8 b" a0 T% nthat device if it is installed., e0 m6 O0 x, ?$ p2 C* T

; @* i9 }/ ^  f3 l, e" j+ e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' ^: o% @3 D  ^" w* m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 B- Q9 G5 ^. ?# B8 F   VMMCall Get_DDB; _0 p9 N, ]% U$ e
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  P5 L* ?+ z# A
% |1 y' I& w- ~( ~
Note as well that you can easily detect this method with SoftICE:
1 h1 P9 L6 q9 g& t1 q! O# y0 [   bpx Get_DDB if ax==0202 || ax==7a5fh
" T. p5 K5 O3 N7 S, ^
: s% s4 l" D7 C: D2 X; r__________________________________________________________________________3 D0 X0 q( `" v* @

3 S9 o1 h8 t* Y* P% RMethod 10
! m4 r+ X( K/ T. Z. Y=========/ @5 m1 @7 L! T8 D, ^% m

$ ]0 p- r4 K8 p, v5 a=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
7 z) w" X  V  C  SoftICE while the option is enable!!
' R0 W) q) S# ?% P- [; i2 _+ h/ }4 p7 e$ [* G0 w
This trick is very efficient:
6 }9 K( h# ^; A6 w/ @by checking the Debug Registers, you can detect if SoftICE is loaded
- D6 [" _9 ^! |8 d/ b, \8 b(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* A- O9 }" z$ K7 R3 k) j. lthere are some memory breakpoints set (dr0 to dr3) simply by reading their; y( T( K# S  p4 q- w
value (in ring0 only). Values can be manipulated and or changed as well
( |0 _9 _2 Z' Z0 s9 u(clearing BPMs for instance)
& R  ^; V7 o( U
& z3 f, U) {5 ]$ r6 T# Q__________________________________________________________________________# N" n7 q6 k- G: y* C+ M
# w( D, i: x: E) I) K6 F
Method 11
, M9 G0 b" ^: G3 |9 q1 o2 d=========# q. t! g2 c( @& B! H
* O1 U2 q- H+ Z5 x
This method is most known as 'MeltICE' because it has been freely distributed- A3 U* K+ P* T1 p
via www.winfiles.com. However it was first used by NuMega people to allow
% J* w- i6 P. D* U* U" fSymbol Loader to check if SoftICE was active or not (the code is located8 Y/ h2 Q2 y7 H8 P. O! g
inside nmtrans.dll).
/ M- l- ?5 z1 b8 P2 D$ p5 r$ K) w# u4 O- f5 P+ J
The way it works is very simple:
; y) F( \4 t9 P1 v9 cIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- R7 R' x% q3 i& X
WinNT) with the CreateFileA API.
6 K3 y* {7 r- {# c' i
+ B9 l; p' F# n5 N! yHere is a sample (checking for 'SICE'):* P; P; J' n; }) ~) \3 ]; `# n
5 }' m4 a$ C- T$ S
BOOL IsSoftIce95Loaded()
8 o7 V, v  V& n  P+ L{
/ Y% H5 \$ U4 n: T5 w4 o7 N9 ^   HANDLE hFile;  
6 z. w# t  \: J9 Q# I0 K   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; Z. J; e& @2 f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. c* D0 u3 n: B: X
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 }4 @3 |, u" G: D   if( hFile != INVALID_HANDLE_VALUE )
* X- R% w+ Z7 c* N% d4 U   {
  u1 m/ x. c6 s: C8 l: c1 x      CloseHandle(hFile);
4 R( `6 w! d7 H. M. \* q      return TRUE;
. s; T) z. R: F6 G; v  C  `   }
# k  z  M# a( ~2 x   return FALSE;
' B3 i8 n6 ^; k# q% f}
% E5 D* F7 g5 S- C( x; t1 j; g$ |' ]4 ^0 e9 g( D
Although this trick calls the CreateFileA function, don't even expect to be
, F! u1 s7 k) ?, t, Z: Hable to intercept it by installing a IFS hook: it will not work, no way!. V* q& o" a& k/ X
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 w* K: `2 B6 a) U2 b% iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function): _; P# v8 ^: z0 O: J2 I5 z; E
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 z9 t& R* w' G2 R
field.9 k/ a  c/ q( y- ?7 U. i/ p
In fact, its purpose is not to load/unload VxDs but only to send a
0 E5 r" R* ]7 e# [6 xW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 K% Y6 A6 Y7 N3 v- N/ kto the VxD Control_Dispatch proc (how the hell a shareware soft could try0 `( S4 o, G- b" {
to load/unload a non-dynamically loadable driver such as SoftICE ;-).4 V# E/ V. _1 X5 T# a* h5 S1 t& x
If the VxD is loaded, it will always clear eax and the Carry flag to allow
& d* E/ d$ Q4 B" d1 c7 i1 C3 ~7 rits handle to be opened and then, will be detected.1 o6 q' @+ o2 d' e6 I( j
You can check that simply by hooking Winice.exe control proc entry point3 u9 k5 K! P4 U3 n! V; S' b
while running MeltICE.
- S; ]0 ?7 i" M( p6 _8 ~# U
4 z# y  d2 h) }9 V& ^4 I# k$ r
; f) t- K$ I; \! O4 j  00401067:  push      00402025    ; \\.\SICE) C# d( O) T$ C- S1 Z5 {
  0040106C:  call      CreateFileA1 L) `) G/ H$ m- h9 P
  00401071:  cmp       eax,-001
; D9 D5 P" y% ?  00401074:  je        004010911 f+ ~, T* @: W; D# `- O; t

; B$ l$ S  [! x7 E6 B' `! }
, S+ J. G! F; M  f) E$ A' KThere could be hundreds of BPX you could use to detect this trick.
4 H  t/ J; n; M9 i* \) Q( q/ `-The most classical one is:
4 a" d5 m# S/ R. L  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||7 K8 Y& w; e9 `4 t; z0 t
    *(esp-&gt;4+4)=='NTIC'  E' e2 K, E( m# g) N

, H- |& z( I/ A' G' C' l* m-The most exotic ones (could be very slooooow :-(
5 W! ]+ F7 Y+ ?3 ~   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! I3 D/ Y" u4 P/ s! w2 L. k4 p     ;will break 3 times :-(
9 z9 }0 \9 [+ z$ X) t; W6 }
. m3 I3 s, h9 D; `4 K/ B-or (a bit) faster:
; [4 k1 C! Q0 {   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 t# V0 l& _; \! S) U; B  z7 k3 H* w; R0 o8 ?
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 U5 \. A; ~& a+ v7 y0 L     ;will break 3 times :-(( ^+ |! d0 ^% j8 k2 [5 e( q

; N5 }& l8 V4 `/ k+ d2 E2 Y-Much faster:: _& H1 X5 M  j  V7 d* @6 e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 b4 O" O' [- A6 o1 k, w
- V9 X/ d2 f: r  f
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 e+ J% e! v" |% A% m) y+ H: j
function to do the same job:. N; j, K( {" j" `: l- {1 f0 G
6 b' o( f; _7 @7 Y, W
   push    00                        ; OF_READ
3 v5 K% m" A4 E* q4 v, Z# g2 L5 e( \   mov     eax,[00656634]            ; '\\.\SICE',0
' b; X! I8 e: W& q+ X8 k( l/ ^   push    eax5 ~5 V& ]6 x2 Z
   call    KERNEL32!_lopen# K7 E* r8 o8 X# E
   inc     eax
. P2 ~' }- F; H7 j1 _   jnz     00650589                  ; detected
2 c5 Q' s1 }4 }8 X) G   push    00                        ; OF_READ0 R! k, `2 h1 \" M0 X
   mov     eax,[00656638]            ; '\\.\SICE'
. f3 t/ n( F& e. P. q, G7 n; G   push    eax
0 B( C4 o0 \1 V5 h+ X3 D   call    KERNEL32!_lopen
) K+ O. G" v% h; }/ h   inc     eax5 s3 E+ ^* x1 v  b5 |: U% m
   jz      006505ae                  ; not detected
* r  G' h: _' D# p, i0 \9 `
6 R! \! N1 {9 E" u( h% @# e$ p. x/ `2 h
__________________________________________________________________________) H" p& I% O' j1 B4 G, G  j, ~
( t7 d3 R9 ^- C0 a+ w
Method 120 k- m7 _5 P  v9 r7 G8 x% n8 G+ }# _( B
=========* k* w# @- T3 z0 ^
0 _# S5 F7 J; c2 b8 H4 c9 B$ P
This trick is similar to int41h/4fh Debugger installation check (code 05
3 o8 g- @: H+ v7 Q# t; h&amp; 06) but very limited because it's only available for Win95/98 (not NT)" U# [5 I& Q7 o3 B) |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
( p9 u( {& e& d- x. o  I- M( G5 {* X# h4 [  i; u/ j
   push  0000004fh         ; function 4fh* n1 w$ v7 G7 G3 n" n; x" S
   push  002a002ah         ; high word specifies which VxD (VWIN32): t, ?$ O0 ^6 t$ d9 M; X
                           ; low word specifies which service
# H. O5 h% `: s# g/ c9 R( [                             (VWIN32_Int41Dispatch). H4 o5 a9 D# b4 `$ }2 ?6 B: N
   call  Kernel32!ORD_001  ; VxdCall
2 h3 L- ~9 c, e6 l" _8 r   cmp   ax, 0f386h        ; magic number returned by system debuggers( r  T$ }3 }/ W% y4 u$ B
   jz    SoftICE_detected. S7 J9 ^- J, W# t* O+ k7 H

! C* D- B5 W  [# Q) tHere again, several ways to detect it:
( N; f5 B" a+ y0 K
) v1 G# s) w- d2 F& h    BPINT 41 if ax==4f
! a) h: b5 s& i) ~2 @
8 @8 C& Q7 t0 |0 K5 ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! v7 i5 ?/ r9 l' p" ^* P" I2 |2 Z; k# u
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* a5 ?* E6 z! U  v% Y9 k- g7 @3 L$ H

4 P$ N# S2 _1 U$ ?  S" D7 x) C    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 ]+ y9 e8 B, ]) d4 ^0 \8 O
! V) A; m3 c9 U5 Y3 ^$ C__________________________________________________________________________
* l/ Y  g1 y9 _- ^% @2 G6 X0 f3 a, T/ W% ?
Method 136 `$ P: F" a) Z! y4 k8 x
=========
. W' ?( u9 |9 r4 `; [3 Z; g" ?2 k- q- x
Not a real method of detection, but a good way to know if SoftICE is; b" N, @% c% D) j4 R/ U
installed on a computer and to locate its installation directory.
6 t* L+ [2 U+ D# T8 t' KIt is used by few softs which access the following registry keys (usually #2) :3 ]6 @, e8 [+ W9 o0 e2 m7 s2 B

; m: W4 N1 c) `! [-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. v+ |* u; A% t5 Z& g
\Uninstall\SoftICE
0 Z) d6 f% b% g$ l9 B-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. F* [6 U5 E7 q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ o4 o3 ]7 h6 `/ J5 J8 I
\App Paths\Loader32.Exe
2 u4 x  `  m) \9 E
. x; I! m( W2 F4 Y8 `: J& s; b
  k' g% I* v) P! H" j0 xNote that some nasty apps could then erase all files from SoftICE directory
8 n3 t; d4 q3 O0 p- O8 r(I faced that once :-(
0 J( Y9 J9 i) B0 ]: U+ u
, [: b0 @8 E# D! IUseful breakpoint to detect it:! ~8 Q& Y' N% G) ~
" X0 ~4 n) l  J' r1 t' P
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 {7 b: p! E' L" w6 U9 t+ m, @5 C6 c  ?) W+ Q/ j  H
__________________________________________________________________________1 F! G- ~# e; a6 m" P

- M- }9 B! Y# u% o; G" }- {6 L- o% j/ {/ `  }6 M
Method 14 ' V8 D# \- y1 J' v; a1 y  I! _: N; D
=========
, J9 _2 X7 M6 P3 y0 u8 j
& G. V7 J5 z7 [: CA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 T. J7 }! ?7 v
is to determines whether a debugger is running on your system (ring0 only).
4 Y" f4 e5 X7 g. Q* Z) t# s7 a: C! i( v7 i' Y0 p4 U
   VMMCall Test_Debug_Installed+ [+ p  h. u9 d8 L
   je      not_installed8 X9 L, W& [9 N/ y

) ?3 U, n: O" y' o% K% W4 fThis service just checks a flag.
- o0 G) x5 j0 I2 B$ D</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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