找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, q2 c$ ~5 W" p
<TBODY>
( E# b1 T5 V4 v; N<TR>
. U. I) R' s) t6 }0 \, |<TD><PRE>Method 01
: C/ z: Y: J4 q, I3 X; x=========
  G0 R" k2 d8 f0 y+ M. J) I
1 t. d( M' \8 S8 V2 ?2 aThis method of detection of SoftICE (as well as the following one) is
+ U: Z/ O& v+ p- l7 P- ~used by the majority of packers/encryptors found on Internet.% H( m5 d. f2 X& a, \3 F- y
It seeks the signature of BoundsChecker in SoftICE/ ^$ _, b/ \$ V

: _) \  I4 \5 A# C6 Y1 D) m    mov     ebp, 04243484Bh        ; 'BCHK': Q- t% W, U4 m
    mov     ax, 04h$ c4 B  m* U5 o; [% }6 Q
    int     3       6 G/ e8 _# A4 ~1 w4 Q1 M$ L! r
    cmp     al,4! U; |! @3 M5 Z" m6 c
    jnz     SoftICE_Detected2 k( U5 ?/ l1 z4 }5 f

- i: Z- Q* |# E. _3 C5 u___________________________________________________________________________8 L1 n( A7 g" K, H- ^5 ^

2 o6 L  L! @' u$ M, Q0 l3 MMethod 02
. K! `; J3 l. i5 j% B=========; f" t- V5 `* Z- b5 i( Q- K
; J5 U& G& S' g$ ^, M# @. t
Still a method very much used (perhaps the most frequent one).  It is used
- [/ [2 Y* E$ x, m/ rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,; V. S8 e( d9 d3 W
or execute SoftICE commands...1 p! i6 m8 {/ u. Z
It is also used to crash SoftICE and to force it to execute any commands
5 S( q1 Y3 l7 N$ X" M(HBOOT...) :-((  
7 J5 W- @# y3 y; Q# h
6 _5 e/ Q- ?# K. J5 I, |$ ZHere is a quick description:6 r" s4 R) s$ ~" l% H" m
-AX = 0910h   (Display string in SIce windows)- c- u3 A7 X" y$ o- s7 R
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 i5 h! @. j  V-AX = 0912h   (Get breakpoint infos)
+ \2 o- c# K) B( y$ y7 C-AX = 0913h   (Set Sice breakpoints)% X; n5 M4 R- u. j+ ~
-AX = 0914h   (Remove SIce breakoints)8 z: G- V# ^. |6 ~

, g7 d% G9 [4 \0 N: q% iEach time you'll meet this trick, you'll see:+ W' g. J  s  K; Y0 {
-SI = 4647h
9 y0 O: b' R, V( D$ T( u-DI = 4A4Dh
2 Q) r4 }% u" C8 {+ Q: rWhich are the 'magic values' used by SoftIce.% W, W5 a: X4 d* `6 {/ r; s( H( G
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( V/ a1 Y7 b. N5 [
2 e8 q: X* m! @8 J3 ]
Here is one example from the file "Haspinst.exe" which is the dongle HASP. M9 \1 C# ~  p6 j/ A* J" O5 A
Envelope utility use to protect DOS applications:3 W' o9 e$ _& x
6 ?! g, K6 C- \6 H6 s8 S
# G5 m( i5 u$ U) `' r- @! Q
4C19:0095   MOV    AX,0911  ; execute command.
4 m& a7 Y' x  ~. I+ a# [5 u4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" M& e! L" h9 X+ ]4C19:009A   MOV    SI,4647  ; 1st magic value.
% ?6 V% k* D- |4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  x9 b( l5 P# s# [( S( s4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 G& u7 ]0 O" G8 l" C2 t% l! v3 d4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& l% J) l5 G% Y$ t& x6 p4C19:00A4   INC    CX' r2 N1 Z+ f' U# ^7 Z( i
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
6 _0 b' X6 L' C1 E& K; ?* y4C19:00A8   JB     0095     ; 6 different commands.
* u7 G2 ^7 _2 w) j4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 o; a7 F4 V3 y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
* Z2 v( Z! t5 f5 B" z) L* @
8 |+ \: ]. L8 Y6 DThe program will execute 6 different SIce commands located at ds:dx, which1 g8 B$ u2 @. t% T$ H4 r% \- l" d$ d
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! j( N3 G1 P% {0 {
6 W' F2 X; l. I* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 T' f/ T7 l2 Z7 Y
___________________________________________________________________________
- N$ B  G( p4 Z% u; l' E0 T
: `$ Q, F  h" `( g  W
; ?; Z6 u0 ^( c1 uMethod 03
6 D# A: t! y6 B7 X9 T# y  ^=========+ ^; i4 F# L7 F% w) u% O# z8 H
; d, M, A" C3 C" m. m( t
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* s. r. s% ?, F! u(API Get entry point)6 ]( ?& p# l0 z  U6 A
        
' A0 l0 K4 l- S: `2 d
- Y# L0 C% J  Z& e1 y( C    xor     di,di' j$ x9 F7 j* ]5 p: Y
    mov     es,di; Z1 z: n2 b+ d: W" K" k; V" v) S. E
    mov     ax, 1684h      
- m/ x) J' }4 \1 j    mov     bx, 0202h       ; VxD ID of winice
" A; V2 I! \* a( R    int     2Fh& e0 R  C6 k1 D( O) Y3 W6 [& T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 U- z# P4 t: ^2 f2 U    add     ax, di
, p! X9 r# W# c: l    test    ax,ax3 H! M9 Y. \) z9 n. s
    jnz     SoftICE_Detected, F: T$ ~6 b2 T" L# b' `

1 x$ V7 j! s+ D: {$ h/ d0 _% j___________________________________________________________________________
6 K/ T# U* H' a+ B& D9 f2 Z+ a& e: y. L" {; q
Method 043 E/ Y" O/ h2 D' A
=========
" n2 J* G. _( T3 {3 x
, O0 A* a  p; |4 \. zMethod identical to the preceding one except that it seeks the ID of SoftICE
0 }! A4 f9 m+ i2 ^& }GFX VxD.$ e+ W: N9 T" t% i2 X. |6 f8 t

" H0 f3 I6 @4 n  E    xor     di,di* F# z* y4 G) i6 l
    mov     es,di2 r" a9 T( ~2 `, Z& P6 }) j
    mov     ax, 1684h      
% [2 \% U& z) N& g( |    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 `/ I9 x" g5 A0 i* g8 t
    int     2fh* m/ q+ z4 \4 v  E$ M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) V8 p# H" [/ A6 O: T- A
    add     ax, di8 f: E8 U! J, }. E" @. N% w
    test    ax,ax  n4 K2 m& F% T3 N. \. t9 o5 G
    jnz     SoftICE_Detected- S5 F5 j+ x, N" h& W! Q
9 e5 \& \: W8 z
__________________________________________________________________________3 d2 q, b4 r% b" n- w; w
! B! g- H( `: T5 Z0 U& D% @+ c
! W7 Y6 @+ a) H8 u# ~. T+ f, A
Method 05; m7 q0 ~0 d& y5 @
=========) O# Y4 |, y3 t7 A9 u$ s

7 k8 n& Q( A0 y7 UMethod seeking the 'magic number' 0F386h returned (in ax) by all system# c3 `* x: \7 W; v+ S
debugger. It calls the int 41h, function 4Fh.
8 m; k0 q) t' r# ?$ g' W: V- fThere are several alternatives.  
6 h  U; Y$ ^, H9 _) h% f
; B" @  t; n$ C% C, G4 q5 b  wThe following one is the simplest:2 J+ p7 o* Y& {9 Y! c
4 R% }  m* |9 z' U: o. ^
    mov     ax,4fh0 i8 [4 P* j% p) W
    int     41h; p/ m1 _1 M* S
    cmp     ax, 0F386, ?$ I' Q0 `0 v! A
    jz      SoftICE_detected& f5 M; X' d' `$ l$ ]' Q; k

9 g2 K1 K! c( z2 m0 {+ b
, M1 z+ q% N! F8 I( KNext method as well as the following one are 2 examples from Stone's
! C: b! H: a! Z* g1 n"stn-wid.zip" (www.cracking.net):5 f0 s: @: K+ f) D

7 e) w: V! I) N% s    mov     bx, cs: O+ |, H0 i  v  n0 {
    lea     dx, int41handler2
  f- m5 W4 J; b( G9 K    xchg    dx, es:[41h*4]& o/ A4 `* X0 Q% q# n
    xchg    bx, es:[41h*4+2]
% x0 W! J6 [  O$ }7 |    mov     ax,4fh
0 m# |4 w& V% g: V4 \2 {, C- T    int     41h
  g: ~) b9 a5 h6 F& Y/ o    xchg    dx, es:[41h*4]9 `  o* M& A6 P2 x
    xchg    bx, es:[41h*4+2]
4 ^( o! M; P& v0 H, u# i) l+ `    cmp     ax, 0f386h
8 M( f3 T/ \1 N. T" Z- n3 ]  d    jz      SoftICE_detected1 y0 j+ w6 ^3 R" H* T: u
3 G; M# I# n: W3 a, W
int41handler2 PROC
" Y4 Z  J- f1 r2 R7 W7 z    iret
% |8 L9 {6 m8 @- U- U5 g) i( Y+ |int41handler2 ENDP
: i0 ]& j9 r4 y/ O/ k2 M1 g" R9 G! _4 C

- o+ A$ g! Y4 y. [) \% W_________________________________________________________________________
( ]  U" t5 F/ @+ w9 X' ]+ k( c% X7 ?, X! V* s4 ], Q

* F2 r' d2 C% t! \Method 06$ x7 ]: P' R* I
=========8 V7 v. x6 m3 ~2 K

) K+ R  `. W. v& C9 q2 B  k5 r4 C. A' E; [: R6 z4 i5 A8 l, D: {
2nd method similar to the preceding one but more difficult to detect:! t& P) g9 C& D4 x( z" p& N

5 b) O! f& S6 D$ d, M# W6 F) U; G! V4 n
int41handler PROC/ `$ t- x6 R" }' g) E/ i
    mov     cl,al
9 E- q( L+ `( Y    iret, m: k: L2 {  f3 x) P! S) O) c2 ?
int41handler ENDP5 ?* c1 n% z3 b5 M% A/ g

4 {/ |; f) Z; B+ p& a" g; X/ `  c: _
    xor     ax,ax
  J- P5 i, x) ~) x7 C    mov     es,ax
7 Y( \, H7 L, I    mov     bx, cs
9 ~  X2 T' n, Y    lea     dx, int41handler
& @+ E+ k5 X' k# a' l    xchg    dx, es:[41h*4]
( S" k0 K' d* X9 C, V/ [    xchg    bx, es:[41h*4+2]
' n. ^& i3 s+ @: R, H    in      al, 40h
/ |" V+ d3 g  s    xor     cx,cx* g- ~8 Q- h  i# B" M/ i+ n3 B
    int     41h( G" `% i  t( I/ s1 e# k( e) B: A8 p
    xchg    dx, es:[41h*4]" C0 e! \/ Y9 J0 e) ^* R. P/ H
    xchg    bx, es:[41h*4+2]! h( z& ^7 I9 e3 p& I/ z1 H9 W
    cmp     cl,al
  [8 F/ W8 R( q    jnz     SoftICE_detected4 c9 u9 x* q1 z+ O0 X& b
/ y; \- \8 p( _, Z9 a
_________________________________________________________________________# M) H2 G9 g/ l- F- o' Y7 f# t% v
  I+ E$ k- v# O# J6 u0 |
Method 07; i0 W+ C/ e1 ~( r7 x  h
=========
4 |# N; b5 g2 j$ Y7 D' s0 A. J# L. T/ ]: x
Method of detection of the WinICE handler in the int68h (V86)- u3 @# V) B) j! b$ ]
# S8 J) K7 D% W
    mov     ah,43h$ m0 u& P7 A- F% M
    int     68h3 V# S6 p5 w+ q, e" j
    cmp     ax,0F386h/ [1 ]4 B4 c7 t% X* t
    jz      SoftICE_Detected
2 s5 h0 K( N4 j/ G: p3 m
/ v8 C, H% e* k- A5 |, [5 X: ]3 @; t) u- }8 x: V2 C
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
/ [, H; U* Z$ |# C8 @4 F   app like this:6 d/ x9 r$ q5 `. k: s/ M# b/ u

# ^; u- K1 R( Y# C+ b) S   BPX exec_int if ax==68
' Z' J8 y; F% {) h   (function called is located at byte ptr [ebp+1Dh] and client eip is
( t4 X; q: D1 ^( [' b2 I7 g   located at [ebp+48h] for 32Bit apps)" A$ l9 U% i. R
__________________________________________________________________________
$ J+ `) c, X, t, V0 I% I' n' D5 f8 E5 w2 ]9 |7 W
  x; T3 `( }# \, @+ _
Method 08% I: B# u- ]+ c+ C. }8 V
=========
1 I% W3 e6 o# e
9 S8 e- T4 R2 X7 _4 W! [9 \It is not a method of detection of SoftICE but a possibility to crash the
) Y+ a; C' X" l& X+ Xsystem by intercepting int 01h and int 03h and redirecting them to another3 a# Y& y3 C5 X  s6 y" W" |
routine.
9 `, Z; I5 H- z2 u; z- B. hIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ f: D7 G5 ?/ [& x
to the new routine to execute (hangs computer...), G. t- f3 X9 r
5 p7 k0 y5 s" J
    mov     ah, 25h
! p5 Z. f+ X4 H    mov     al, Int_Number (01h or 03h)& _) J2 Z8 q% n6 p. ?! v- g
    mov     dx, offset New_Int_Routine2 j; e5 d" X! ]/ _2 z8 I
    int     21h* B) `# A3 s7 r! W; W
" `- ]5 U* P$ c7 w
__________________________________________________________________________5 F5 R5 t; M$ }$ m1 |! f7 B

! M. |, U; [9 t0 N4 V9 N6 zMethod 09
9 Y! `- C: a3 q8 X6 v9 n% T=========
$ p6 Q# O) k' ~- T
  m9 y8 B9 T1 y9 |3 T$ u/ L! }$ `This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only9 W' K4 R- X; [4 L  v  M& x
performed in ring0 (VxD or a ring3 app using the VxdCall).7 G4 G. k7 l% F- Q4 x
The Get_DDB service is used to determine whether or not a VxD is installed
# ]. o) e# S' w: j; L9 F; b1 p, Kfor the specified device and returns a Device Description Block (in ecx) for0 n* @. h# ]% I% g- t# t
that device if it is installed.
+ c% v" R4 `% m+ O1 f7 e& u+ v
# k  }  v' T- a# H  P: M( J7 e0 P   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
5 a! l* |# ?- r4 ~   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 f# J/ w3 l8 a1 S2 L% x( _( x   VMMCall Get_DDB: A" `; p- ]9 w' }' o
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* D# t/ B: x2 ~3 ]! @5 O
' ~9 e8 S( Q7 p2 z3 ONote as well that you can easily detect this method with SoftICE:) m  I; e: L# i" P- O
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ l1 H& u- I+ @: }$ F3 H( R- q) i/ @# o3 L( h+ |
__________________________________________________________________________
9 S) U2 p  B6 B+ v  Q( n. s) }' D. S* F9 Y- y
Method 10
" Y: Y3 i1 N: |9 v2 a=========. X6 G/ `& K1 x7 C; M
" N3 N/ Q; i9 a2 s& `( i3 e  J- V
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 o2 I) Z+ o' T6 D8 n3 P
  SoftICE while the option is enable!!' J% G& A( C* L/ B- G2 b

9 m/ X" T" Z& C$ ^2 s4 K" qThis trick is very efficient:) A- L  X% F2 Y1 C
by checking the Debug Registers, you can detect if SoftICE is loaded
) ^, H/ p9 y9 y; i' d% @(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
1 \5 d% ]" U" S$ q7 e6 ]there are some memory breakpoints set (dr0 to dr3) simply by reading their
, L- Q, O6 K8 {value (in ring0 only). Values can be manipulated and or changed as well! D$ Q  @! E2 L4 n8 q# @
(clearing BPMs for instance)
: e/ f6 L4 I0 M% Q3 t
3 H+ X" L: O  \* G9 \3 G__________________________________________________________________________
9 p) S; r% l& T$ R8 T- F
1 j2 I! s3 l8 J3 |! RMethod 110 j% m* @0 J* e% L* Z- y
=========
- d2 T! K" B( Z
: }% X2 t8 e# S: V% yThis method is most known as 'MeltICE' because it has been freely distributed7 x, c. l+ x/ ~
via www.winfiles.com. However it was first used by NuMega people to allow0 c! d* n5 @# Z% L4 n% t  O
Symbol Loader to check if SoftICE was active or not (the code is located
& I3 C9 k% d8 L6 G: R( C# Ainside nmtrans.dll).
0 i8 i: M8 Y$ k7 r
* ~8 ?9 W& `/ Q& I3 o9 HThe way it works is very simple:
8 G8 O; {9 ^4 M* C: LIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
* q! A2 l, T. a! YWinNT) with the CreateFileA API.5 s2 w* Z) k4 u

& s0 f* y. _5 o3 o3 F- DHere is a sample (checking for 'SICE'):5 ~6 Y5 G. J2 u5 y4 b
8 W: T! ]+ N# |9 ?, e5 `
BOOL IsSoftIce95Loaded()
# r3 k' x# H, r7 o{( D6 |/ T* k# m6 H$ q6 R) @0 ~
   HANDLE hFile;  
7 u/ S  S0 {# e$ v% O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
, t) I! D/ P& k5 ?/ N, A                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 l% o( }. H- z& N; q# c& e% o& E
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);3 z: L. e6 v4 j7 m8 t% L
   if( hFile != INVALID_HANDLE_VALUE )
( l" D2 i/ ^3 t' [) b& ?   {" {8 r' |7 ~3 M7 z0 E
      CloseHandle(hFile);
* m: v, S1 i" {6 x6 Y      return TRUE;1 _! @) D/ G* P3 J2 h4 P
   }: m9 B+ X( I0 {# H# g# v
   return FALSE;
9 Z0 G( ]" X0 z}, O. ]% _( Z+ J! X1 o& V
- X2 C! A2 s$ F
Although this trick calls the CreateFileA function, don't even expect to be
+ W8 V2 D9 l+ c7 u- Aable to intercept it by installing a IFS hook: it will not work, no way!
; j) e$ a& R. I/ Q' vIn fact, after the call to CreateFileA it will get through VWIN32 0x001F) t$ m7 |4 Z1 a1 \6 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& g( \$ M3 v6 C/ ^7 m8 U. yand then browse the DDB list until it find the VxD and its DDB_Control_Proc! e. v* Q8 v0 }/ q. ^# w/ x- @
field.
" ~4 D5 N; J7 N8 _; P7 M. X# aIn fact, its purpose is not to load/unload VxDs but only to send a
: z7 _) r& x. b5 y- k4 l$ AW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( B; `. T, s4 r- B. g/ q; @
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ W  P' W8 E8 P2 R% F6 i  u
to load/unload a non-dynamically loadable driver such as SoftICE ;-)., S' @/ c5 p; G0 J2 T. `
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 r- C8 }0 I5 T7 J1 _
its handle to be opened and then, will be detected.
+ T  K, j% P9 z, J( w$ f1 ~# hYou can check that simply by hooking Winice.exe control proc entry point
9 ]2 R( F, m6 l  lwhile running MeltICE.
2 Z; c( d% r1 T6 u# D! I) O( A
% c3 m, E2 @; p; P2 i
+ ]/ n! ^! L0 u3 d5 K: y2 U. m5 q$ G, X  00401067:  push      00402025    ; \\.\SICE1 f" E- x& @/ L2 Q8 w
  0040106C:  call      CreateFileA
2 I0 X  I/ A& i3 }  00401071:  cmp       eax,-001
; k' b) A( k$ t, z/ W; K4 ?2 n" \  00401074:  je        004010914 F) A. d& N6 e; e# G& _
# a4 C9 S( b% n. u/ s7 Y

* y! L, m( F- Z: J! }There could be hundreds of BPX you could use to detect this trick.
0 o7 R/ p0 q- g+ v1 s-The most classical one is:
# d/ W# s8 x) ]' S. S  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 w3 R5 K- R% I5 E! Q6 k    *(esp-&gt;4+4)=='NTIC'+ K4 ?' Y2 T2 c" @4 f1 Z

% C- a+ N6 M$ i: G# J1 _-The most exotic ones (could be very slooooow :-(
# P# Q+ S6 M/ T; _3 f+ ^   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 ]7 V8 d8 l4 Z2 I1 c  T
     ;will break 3 times :-(
! l! o) v8 ^  M& s* B7 o4 [( I4 V: d4 N  Z6 n" N% M
-or (a bit) faster: * I  f% F! H, [' j+ H. z" N. q6 [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. Z  [" O' n3 [
3 \$ ?+ `$ K! @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 D& Y0 F' f) C& ?7 K     ;will break 3 times :-(9 y! s! M1 D4 [% `" E1 p# _1 y
4 {1 {/ G; I+ I7 V
-Much faster:
  O( G) _+ N, ]6 @6 V; J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 _: _) Y( T( b& l; l8 |% N: D4 ~
' h! J' D6 B! `5 ?0 k8 a$ RNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
' s% o& H  d; n, S$ v& E5 Mfunction to do the same job:8 h5 D% ^( @" J7 G

( S- T! J2 |3 P( y5 r0 u, K  o   push    00                        ; OF_READ2 L& ~: y* l0 D4 Y3 T  N
   mov     eax,[00656634]            ; '\\.\SICE',01 V' V: Q0 `  [; G' b( l
   push    eax0 u7 L; n( [% a8 t# b3 W
   call    KERNEL32!_lopen
. u' _& s+ u) H0 t. q   inc     eax! _" @7 d0 N/ J1 r  B: ^
   jnz     00650589                  ; detected; |$ {% L5 D/ G
   push    00                        ; OF_READ; p% \- Q4 E% V) e0 u" D! r
   mov     eax,[00656638]            ; '\\.\SICE'
8 [: \' O& O0 y, v   push    eax
; K% C/ `( k2 l8 X$ ~, l   call    KERNEL32!_lopen
1 p, N9 g* h# T5 n* u3 Q6 M2 Z   inc     eax! Z7 S$ D9 ]! v5 l" ~5 L/ R) Q" R
   jz      006505ae                  ; not detected
  u9 \1 |; L0 B$ \
& S' R: t; |- Q
  o& z# q. [  z) V( ]% C2 @( p+ a__________________________________________________________________________
* ^$ i' P- j9 y8 I
5 v$ s7 A7 h$ g5 {4 e8 GMethod 12( v3 |+ C! L7 Y3 A" W; b9 g' O
=========
: K8 ~. D+ a! n1 E8 h- t; \0 T7 i7 ]. a: |) }# D
This trick is similar to int41h/4fh Debugger installation check (code 05: f: e! A8 c# {0 z/ P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' q1 Z1 X; W9 E8 o; i7 j' \as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
) y6 G* |* O2 [
. E  d6 ~, i9 X2 {; L: M   push  0000004fh         ; function 4fh2 l# L3 D3 A) Q* W
   push  002a002ah         ; high word specifies which VxD (VWIN32)3 E( c- f. s+ O! h
                           ; low word specifies which service; ~) i% d7 _) H9 p+ P+ b# `6 ^
                             (VWIN32_Int41Dispatch)
6 n3 O4 z" ^0 T9 A+ {   call  Kernel32!ORD_001  ; VxdCall
5 l. w# s3 R5 e7 t: P' q6 v   cmp   ax, 0f386h        ; magic number returned by system debuggers4 B. Q5 u' O. M  f7 F
   jz    SoftICE_detected
& l: V9 O# j2 e! ^9 P9 q# S1 o/ @6 O( q& w" |# n% d9 G
Here again, several ways to detect it:
6 N5 T! m0 Z4 e$ k- |
* \, b% ]9 C/ ^& p) z' x    BPINT 41 if ax==4f
; |: z5 w9 r- T) V# n- D% X( F: X! l9 i2 @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 N- X7 }+ T4 y" H% z9 J1 W. A8 P# C0 Z3 `4 R/ Y4 v% _9 p. D: P
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& ]  J4 F* P% [2 l+ F  o
5 p/ |5 d. N+ p+ b. b7 s( l
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 B* }0 L2 c6 V) a# o8 g0 ^$ z9 B$ p; P1 i0 ^
__________________________________________________________________________. H* M2 m: s) l# i$ _' D6 r

1 J, i- Y; p: U* J3 CMethod 13
$ j+ q! E$ e5 `0 G3 O% i9 Z3 B: n=========6 ^8 V  }# W+ \

# T! N3 b; v1 Z. ]Not a real method of detection, but a good way to know if SoftICE is- J% X" Q0 Q4 @$ c4 }
installed on a computer and to locate its installation directory.' x, X$ p9 J& S  M6 ]
It is used by few softs which access the following registry keys (usually #2) :
9 |0 e  {, f$ K7 z. S3 Q' Z
# _" _2 I# N; [% L8 [' f( J3 K-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 Y: s: e9 q- ~
\Uninstall\SoftICE. }, T' R9 N* @9 a3 c8 u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 D7 Q3 w2 |$ I( g2 q7 g5 D: K, }-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; t3 G. h6 s" u, Y4 k
\App Paths\Loader32.Exe$ ~/ N) s1 M9 `2 ^- H* z
4 F$ V- }5 G& D7 W. I( |
- U" z* E* I2 w; o" G9 U* C
Note that some nasty apps could then erase all files from SoftICE directory8 L! ~* v8 n) H# z3 J, O
(I faced that once :-(
4 l! J5 I0 d, m) Z/ [% B8 F4 @1 p
Useful breakpoint to detect it:% G0 ]+ s' w: R/ H6 o3 }

# G7 T* t3 F( R: D* g& j1 w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 {. o; R: k) L4 R
# c: r2 M, ~$ T% h__________________________________________________________________________, O/ [, o, k# v' h
1 K, K3 E0 m  O4 m% T
9 e; n/ m# W6 R; b+ j" Y: d
Method 14 + ]" e, S; a+ P, b! R' m& [; X
=========# K/ _+ ]8 _0 Y" m* |( R& D( Z8 f

. D0 m% E+ O2 P+ }4 X$ ~A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose: ]9 ^7 k/ I! b  z+ k  u4 q: e8 c; B0 X
is to determines whether a debugger is running on your system (ring0 only).* g/ j- E! r( i% a0 ]3 ^# |

( U& c) c2 g! I$ }# A; r   VMMCall Test_Debug_Installed% |3 c- b9 f; ^, ]$ E7 Z3 V
   je      not_installed
, Q# [& p6 c( c+ r8 I* W
3 U  Z: A+ ]' }) m9 }: s- ?This service just checks a flag.
  e0 m& p! s6 C) p</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-16 18:12

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表