About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' }9 e  b- K$ F3 G) J$ N% ?$ F<TBODY>* p, ]; F* D, [  j
<TR>
1 o' t& O% d) \& J/ u<TD><PRE>Method 01
' P# N# v8 v1 [$ _+ u=========) V0 }' b9 x# d2 {$ ]3 n$ B: N6 m% u

" f' q/ [! H; y3 q/ m) x* D  j2 VThis method of detection of SoftICE (as well as the following one) is
8 e. c; D- r  I9 ]/ R# qused by the majority of packers/encryptors found on Internet.
' s; l. u6 y+ J, _( @It seeks the signature of BoundsChecker in SoftICE
$ `: V4 U" j7 ?4 d$ p  E2 u8 t4 i' V% y# z( R, v" x. D
    mov     ebp, 04243484Bh        ; 'BCHK'2 b5 Z* |$ E1 e6 o$ F- }2 G
    mov     ax, 04h
+ }' g& o3 p) }3 R. y% \0 Y    int     3       & W( W1 L& n; E) u
    cmp     al,4
# \6 H# W! [. R2 u' P" P    jnz     SoftICE_Detected
; P) p% y$ d" v7 o; S  B8 U8 k6 t6 x: Q0 t: r! n* e0 Y
___________________________________________________________________________
5 r1 S/ I3 y/ J; @( K
; f8 K5 J! Z, _8 CMethod 02, |7 L8 `, B. L) g) `% U7 `! N
=========6 K- Y! |: h" j+ X5 U) w1 J: [

9 U. y4 }4 _( ^" f" [# yStill a method very much used (perhaps the most frequent one).  It is used. A& h: a" a% S. U, s2 k
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,1 u$ A' b& {& O3 F' {$ ~- x& s0 F7 D
or execute SoftICE commands...
6 a1 d/ d  _3 eIt is also used to crash SoftICE and to force it to execute any commands* \( o9 w, m3 [( L
(HBOOT...) :-((  % A: v: U/ }, Q" r+ g2 T& G
" _! }0 j4 W* X( H% a
Here is a quick description:
/ t" b" i& T$ A. b/ n: q8 M/ a-AX = 0910h   (Display string in SIce windows)( j; i+ t0 H* O
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 f9 s4 l0 H5 s. m! r
-AX = 0912h   (Get breakpoint infos)' i7 n2 b9 E" O+ B7 c) a
-AX = 0913h   (Set Sice breakpoints)
8 P" o. J0 k- j-AX = 0914h   (Remove SIce breakoints)
0 \& \9 w# Z7 J) [
! p' Z4 m7 _6 y( C; J3 z, WEach time you'll meet this trick, you'll see:
5 D/ Q- {" P) ?! y-SI = 4647h
  ?$ I' c5 T7 g6 ]$ w& R-DI = 4A4Dh' k8 U( D2 T" M* m* T) Q" e
Which are the 'magic values' used by SoftIce.
* T& K6 ?( P  j$ k  fFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 r/ L1 {/ p) j4 \. G, v4 q

% V' D1 y! _6 @- DHere is one example from the file "Haspinst.exe" which is the dongle HASP
9 |( _7 u) a' ?Envelope utility use to protect DOS applications:
  p4 ^" a; W) T) I
$ j! |) I4 r. W- N4 S9 s) f' q" k3 t9 p
4C19:0095   MOV    AX,0911  ; execute command.
5 o! W! p# g( ^4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).+ l/ P. K! x4 Z- b2 n* f2 v
4C19:009A   MOV    SI,4647  ; 1st magic value.
  g5 m) @) ^0 m) w8 j4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 i) n. k3 ?# R5 a+ I1 r6 T, x4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! O) F5 M7 E: P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, e- p! T) G" _  [$ @" ?: x4C19:00A4   INC    CX
' a. P- A& G1 I; s4 y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" f0 W5 G- W3 v" J) ]
4C19:00A8   JB     0095     ; 6 different commands.+ I* x& s3 X8 [
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 Z/ J3 I9 K% l+ T5 }/ U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 F+ v/ e& A8 |9 `4 T! x  l/ X5 L5 O" R
The program will execute 6 different SIce commands located at ds:dx, which" V/ z' v0 i( U
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT., Q% f2 y. Z# P" F* k6 q/ D
5 m* Z" k/ a" k5 W. B
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 \) y, H  L7 A6 V, l" }- C7 Q
___________________________________________________________________________
" S* y% D" P, p4 p" D0 G' x
" W" J; D( N# `% k1 [1 R6 O) f
3 H- [1 f: I. L3 U$ F( F6 F* NMethod 032 F/ ^3 r& P  N! T+ ^1 a, b9 k
=========
3 B/ \8 T4 X* J
. w9 S2 A- s! I( `$ cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 m5 p! E# N, ^
(API Get entry point)
1 F8 p7 q5 f* e% P" P        
' @# s, @' S% Z
0 P- F. L. T3 l2 B: T    xor     di,di/ K: @! ^& a5 o, W
    mov     es,di4 o2 }- Q* M0 K/ I
    mov     ax, 1684h      
% E+ [" H! o* X# \  M& I3 _0 d    mov     bx, 0202h       ; VxD ID of winice
8 h: [, Q! `6 l3 t% h$ f    int     2Fh
  S; ?% @; ~2 R' T    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; P8 J6 J- p2 W, ^, u- ?4 e* @. {    add     ax, di
, ~0 P. x4 U, u5 M* C& \$ d( y    test    ax,ax0 m: l. W# j# {& P" u; a0 E) A& K2 I
    jnz     SoftICE_Detected
/ W2 \0 q& y7 I/ x/ x5 [: T  X/ _, D* |5 W  v: M0 G
___________________________________________________________________________! U& X- b7 b! u5 E5 }

' ?% Y% p0 R3 C0 `' r* S5 T& Y0 [9 CMethod 04# V: j( s: v5 I9 u6 i# T) a
=========
  g0 b6 A* O5 x+ @. L; Q' q  ^% k, B5 [" {8 P' k9 `
Method identical to the preceding one except that it seeks the ID of SoftICE" v! P! Z" }5 d
GFX VxD.4 w! f9 U) x( |2 c. d- u9 D  {
) m0 a5 V( t* k; Q8 e, t: I
    xor     di,di9 A+ h! T( U5 W: K& s% `1 s
    mov     es,di
# g# C  e) A2 _    mov     ax, 1684h       . R  Z8 `5 M" @9 W! W
    mov     bx, 7a5Fh       ; VxD ID of SIWVID  S8 R' ?7 x7 o6 N4 g, I$ X, L# K" D
    int     2fh
" T6 B$ ~* Y" F7 T; `    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) \6 V5 p# I! o: b) o2 L) I    add     ax, di
" L2 d6 z1 D1 M- q    test    ax,ax
2 b. l" }' T* y; Y! N  U2 L    jnz     SoftICE_Detected
$ L/ {9 b  m* G+ K1 o, o) Q6 E6 y" g3 d! @$ \
__________________________________________________________________________
7 G( |& P) {' g8 t% {" H0 e6 G% v  l$ x& R; e; z5 u

- T* b: s, Y# |! m% @& pMethod 05
4 p' m- p8 Z3 J7 X/ {=========
9 [' \1 f+ F+ \1 l
; }) d/ v1 d+ t7 o" y6 f8 FMethod seeking the 'magic number' 0F386h returned (in ax) by all system0 a) K  s, T% {( b9 b
debugger. It calls the int 41h, function 4Fh.
# p6 r6 c; ?( ~' d& B+ g& LThere are several alternatives.  2 r) j" K7 v3 y: ]
5 F( u( v' F3 P: a8 m  m
The following one is the simplest:8 J4 W% }/ ?3 K, W  B/ T. Z8 `  S! p
8 f1 V! F. M3 T
    mov     ax,4fh; D1 N1 ?  e4 v
    int     41h
- @9 U' o6 W" v# A( G6 Y8 E    cmp     ax, 0F3861 R* o! E6 b# u, O1 @# E
    jz      SoftICE_detected
' L& ?! o$ c: I$ H& s3 ?8 v( M1 x  K5 j; v

$ h' m7 t) i# F$ x/ RNext method as well as the following one are 2 examples from Stone's
1 b" p6 H' x1 }7 J' s! H' ~: H"stn-wid.zip" (www.cracking.net):
5 Q4 k" i+ V4 D7 B. L3 h' i6 I; F7 o) v2 K7 M
    mov     bx, cs2 `7 Q, K/ S5 t) E) Y# v
    lea     dx, int41handler20 Y2 a! q! B% l7 |* I
    xchg    dx, es:[41h*4]' @4 w( q& k" X/ P5 J
    xchg    bx, es:[41h*4+2]
3 X, o0 Y! U( `! D6 g  p4 _0 d& z    mov     ax,4fh: {, e1 p* X- Z* q) p
    int     41h5 Q5 M) X- z* F: {+ L( f
    xchg    dx, es:[41h*4]
- ~4 N  q* u* ^$ l) n    xchg    bx, es:[41h*4+2]. Z4 A. G5 o# c7 a; N+ p$ B
    cmp     ax, 0f386h5 `+ s! z0 @# {, w6 c' i
    jz      SoftICE_detected6 t. a" g1 w" J& A

- Z0 ?7 i* g, a6 `- tint41handler2 PROC& d9 z% m4 A: ]4 d7 z6 v
    iret
" u4 P7 M; Q' O) mint41handler2 ENDP8 S$ K  M- ^" h

, @; }( k# D2 q0 ]- }6 M
6 `, G4 A1 s& u7 T; V) h3 _0 G_________________________________________________________________________
* }3 s  `2 X3 }4 ?, G, n$ g
2 ~) R+ m$ Q4 @( _
( N0 U0 p7 W& I/ Y+ E* TMethod 06
( D6 w# k7 V8 s4 `=========# g: I& T+ c* Z$ l+ r& o" V
6 z: O7 V) m8 ~  E, ]/ Y6 j' }
; M- Y2 e, S- Z" H9 W
2nd method similar to the preceding one but more difficult to detect:
4 C7 Y$ N  |' ]8 l$ m/ ^
0 Y4 ~1 i0 T7 P$ o% E* G2 [8 W# }2 V( Z; C9 }
int41handler PROC# C, G2 X, y! {# \
    mov     cl,al$ \6 S5 x9 v. `' n8 D
    iret
6 X4 Y" q+ Q9 ~+ b$ j5 wint41handler ENDP
1 z" _1 o1 r* d" K; ^1 Y& K+ D% M0 L* l. [

0 m( x+ L. U, a$ ?( Y" |* P) D    xor     ax,ax( v  b# p8 v5 j# E$ `
    mov     es,ax
- w, h" ^5 X) s: f  v; _    mov     bx, cs
& S* [, K9 i1 c$ D( I    lea     dx, int41handler" K  s9 _2 m' s" |0 g* o
    xchg    dx, es:[41h*4]
3 A: t2 W5 C$ C. T  c    xchg    bx, es:[41h*4+2]
/ f0 p% c/ e; q  C8 S    in      al, 40h: K& \; m+ N% N3 y
    xor     cx,cx# R  Y! e5 R* f  g! o( e
    int     41h2 S* a% d; {3 e+ W
    xchg    dx, es:[41h*4]
( U$ G2 t1 W7 d: H    xchg    bx, es:[41h*4+2]
# i( \7 N3 R: ], z7 }/ L* X    cmp     cl,al
* |- L8 I: P) K4 w/ L, A+ E    jnz     SoftICE_detected: W  G4 W4 ^& W; b

- O7 V" z: C5 B2 v% u_________________________________________________________________________
% k/ j1 W' p; l2 c6 J/ {, h5 F" d/ Q0 w) q' r+ j; s
Method 07
8 V0 U6 O; M5 r4 R' p=========
$ {( |, e* b. @- |* J
& o+ o8 i9 ]0 A; N9 `Method of detection of the WinICE handler in the int68h (V86)
! E" J7 V! D' U: N) t: O
" S  @! z& h  o% K1 L    mov     ah,43h* s) U0 q; V* x  I
    int     68h+ {( q! G8 v# J3 G0 Q1 z8 a  O
    cmp     ax,0F386h+ c# C1 _! }3 Z, V# S' g9 C' L
    jz      SoftICE_Detected
& c$ {8 e3 u6 _" a; C
; O" z5 ~2 s6 \
# B3 F8 }% q. ]% O" m2 N  P=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 z7 C8 V# e, [4 _3 q. l7 }   app like this:6 P4 Q4 e: a8 D) f" \
! S$ z0 p# h% Y9 y
   BPX exec_int if ax==68
1 r8 B& N' ]* Y9 X1 k. Y5 m: n   (function called is located at byte ptr [ebp+1Dh] and client eip is2 Y. g. X/ b' x" A- Z! a
   located at [ebp+48h] for 32Bit apps)3 u& |& D" Z% @2 h! N
__________________________________________________________________________( d, M9 U: ]" [/ Q! @* q" d7 L. P3 G

# S; p* a2 }) [/ e3 M' x& P3 ~+ J- j& [0 s# l' |+ N: w2 j
Method 08
. m! ?9 \- `5 M  }/ b=========, y7 R& j3 Z8 z8 k( k5 P: z3 r

. B5 @% A0 q4 B# ~) _It is not a method of detection of SoftICE but a possibility to crash the# w+ w1 o1 n: N& R/ m4 X
system by intercepting int 01h and int 03h and redirecting them to another
; j' `$ L, Q7 N* T- Hroutine.4 m1 Z& _8 J: l' p7 |+ ]
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 w# w) k7 Z, Z  l
to the new routine to execute (hangs computer...)
$ `9 t* @' B0 r# b( \
1 u3 b/ H+ I4 I0 y: V8 N9 X/ M    mov     ah, 25h
$ z8 Y1 X6 v9 a) F, U- t    mov     al, Int_Number (01h or 03h)
; Q  t6 C3 z% N; m: ]6 Q( x) D" }/ @3 e    mov     dx, offset New_Int_Routine
$ ]- V  e2 T1 Z1 X1 ]! b9 D9 n    int     21h
1 I/ e4 X; \0 J5 H# l( d1 o. j. ~9 K7 M: w
__________________________________________________________________________1 j+ c! [6 c6 R+ |" j

8 w% z, t( \: e* X2 c; zMethod 09
, T9 e, K$ u& {/ v5 Y2 s=========! }9 |/ ]( n3 r# K( w

* ?% U+ t7 s, H. l5 D4 IThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
$ b' j7 H1 e& ~! {9 Operformed in ring0 (VxD or a ring3 app using the VxdCall).* h. l7 L. g# m$ u" P$ P/ A
The Get_DDB service is used to determine whether or not a VxD is installed) s% o+ t9 G1 }: B1 V# C
for the specified device and returns a Device Description Block (in ecx) for5 \8 P3 `" M: K1 P) M
that device if it is installed.) T: I$ S2 R0 K( I- O

. D2 P# T3 Z- q7 u   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
, I) K; E. |7 J, q8 _1 J. h3 \   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
, b5 I3 @; }& M" O- W, L% P9 z   VMMCall Get_DDB
( s  g0 L! Z- `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% z. Q8 A* W/ O2 l0 @

" T( x  i7 W7 rNote as well that you can easily detect this method with SoftICE:+ f; @0 f- ?9 ?. P5 ]2 J
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 N0 T" r* s" G/ E$ f" k7 y5 d  a6 e! a
__________________________________________________________________________7 b7 m% B, ]1 S$ N: M/ p/ s
/ Q+ R% S# U" R2 C8 I% T) ]
Method 10
$ `# A5 \( y  p) z3 X=========
+ y* [6 Q5 X3 I4 s+ x& u! J
2 I- X" p& [7 z5 a4 W7 R) g0 x=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
# N2 c7 ]' k" o& ]  SoftICE while the option is enable!!
  N# m* x- w! T* E  [2 h2 b- E. Z8 G' g" m, O( u
This trick is very efficient:
7 h5 G/ F! h  z' Y) lby checking the Debug Registers, you can detect if SoftICE is loaded0 C" F2 _8 a" J+ N1 V+ A
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 H* D' _7 |; K
there are some memory breakpoints set (dr0 to dr3) simply by reading their
; }$ \2 w7 f# R+ dvalue (in ring0 only). Values can be manipulated and or changed as well
, k9 U) O5 b% b+ R# ]( T# ^(clearing BPMs for instance)
5 C& j, b6 w$ Q! g
0 d/ U$ c5 x$ m7 F) ~8 ___________________________________________________________________________3 j& q- M( `; X  b

7 j" D/ j/ A" e# U/ ^Method 111 I* ?9 O8 i3 n' a; e/ z7 F0 [4 D
=========
% `: l, ^0 l; A( b* N; w9 l. D3 ?" A! F( c
This method is most known as 'MeltICE' because it has been freely distributed
- b" E/ ^* \0 A9 E$ {4 J8 Z/ Qvia www.winfiles.com. However it was first used by NuMega people to allow$ U( r1 f2 h- Y! H/ s" M
Symbol Loader to check if SoftICE was active or not (the code is located9 G! H+ S5 G8 T. C. P3 H
inside nmtrans.dll)." j' D- l2 _% W! T/ d
, _' ^) G3 s8 `. i* w
The way it works is very simple:% o: _+ n' b$ ~
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for- e; R7 a& z& D* Z1 O
WinNT) with the CreateFileA API.! |' [' O- E( ^; z3 |
; m+ Y  b+ k  O  e1 B) t+ N
Here is a sample (checking for 'SICE'):1 e0 m8 u% }1 D+ }( ]: S
, p, ~% F6 V  N* k1 u. O$ x. a
BOOL IsSoftIce95Loaded()- l# I" \& O# L9 D  Y# {
{
5 D9 x; v+ F! t4 h" ?   HANDLE hFile;  
# Z4 [$ b6 y2 b   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 [( w" Q+ ]- Q6 q5 R! l' l" J0 ]$ Z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,* e/ V4 y% n4 I+ f" s/ G! k
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" ~; y2 |' n" |2 m2 U
   if( hFile != INVALID_HANDLE_VALUE )# D" t! m5 A! R: I9 k+ I
   {# }2 K  U) J" c
      CloseHandle(hFile);
# ~7 q9 g: j* p! T# l" D; L; H  L      return TRUE;
1 @( j9 g) u2 {: K- p   }
3 c/ H" P! d8 n$ i) \$ o+ x  u   return FALSE;
  Q' Z  C- n# u0 X9 z6 F3 j}4 K+ ~+ X; _' ?; ^3 i! _

/ k. j  q# o) k: |) YAlthough this trick calls the CreateFileA function, don't even expect to be1 m- {5 H$ T3 k3 w6 l
able to intercept it by installing a IFS hook: it will not work, no way!
$ t: u. O9 S/ W$ {, t4 eIn fact, after the call to CreateFileA it will get through VWIN32 0x001F7 |: n; X. h6 n& u+ I+ m
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)/ |% C* g. `: l, O, B# K
and then browse the DDB list until it find the VxD and its DDB_Control_Proc( P$ Z- X: c0 X8 ?
field.
3 I. ?# P' v& }- U! p. AIn fact, its purpose is not to load/unload VxDs but only to send a 7 R" l3 a2 N  _1 ]; F
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! ~2 R2 {. V+ s+ r; l% R. r- E1 ito the VxD Control_Dispatch proc (how the hell a shareware soft could try
! _6 Q0 K/ f7 S+ n! Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).( F/ z5 N- _* K0 Y: B/ [. w
If the VxD is loaded, it will always clear eax and the Carry flag to allow
+ a( G% q0 C" Q  N; pits handle to be opened and then, will be detected.% L& J0 M( {3 n+ D
You can check that simply by hooking Winice.exe control proc entry point
/ A0 [+ L5 Y" W: Nwhile running MeltICE.3 a. e; W% d9 e' I  i

$ P. t" A. i: n7 u  t) g
! B, [) Y7 V# Z' E% _0 ^2 T$ ?  00401067:  push      00402025    ; \\.\SICE
3 w7 v( Z" E( K5 c; j. i7 U* X' m, k  0040106C:  call      CreateFileA
5 \! k6 K. H8 ]8 L: \( A9 L9 j" w1 ?  00401071:  cmp       eax,-001
$ x5 q9 ^, v1 F/ ^- o* X" A  00401074:  je        004010918 |, h& G3 C' ~1 S

0 C$ p$ s, B: P( D, T3 ^- \7 ~9 K, y2 c. w! [, T2 R+ w
There could be hundreds of BPX you could use to detect this trick.+ B' |- t' c1 t- K1 [) Q* M
-The most classical one is:8 A' l9 G; T9 G4 Q3 }3 Z" V
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 Q! J( j: y: {) ?- H8 ~4 P    *(esp-&gt;4+4)=='NTIC'0 c/ L$ j$ W  r7 n7 v! g
  ], ^+ s& m8 d, R9 j6 t9 y( g1 ~0 j4 ?
-The most exotic ones (could be very slooooow :-(
" X& q4 g4 K5 |; _1 M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    ]/ ]/ H3 t: \& J
     ;will break 3 times :-(% C: c9 q. c7 W% a

+ @7 E- u4 e9 l' b! [-or (a bit) faster: 8 M9 q; j! F( k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 r1 \6 o/ q  q  |
6 W1 }* F) h' t, A4 N. R' X+ A3 t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 H  t! }3 H4 |' {3 X
     ;will break 3 times :-(
9 p6 U0 D, k5 T# h8 }
: ?+ g8 V# M/ ]  m' B+ v-Much faster:
& `( l( Z& m1 `. r   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 \2 O) }" f0 P
2 i/ |, {- P, X: ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 g. l- Y. S6 L; p# Z8 S$ v
function to do the same job:4 T4 t3 `+ x/ R! s
8 @4 T7 X0 q% l0 F. r' D
   push    00                        ; OF_READ/ T& T) s( S, F7 {' r
   mov     eax,[00656634]            ; '\\.\SICE',0
: a5 B% Q: r& g2 _% C( S$ E, Y6 j   push    eax
0 E! a( b5 F) S0 |# I   call    KERNEL32!_lopen5 o" \( Y/ K$ M# |% w
   inc     eax$ {/ E: ~7 T6 C' |/ K
   jnz     00650589                  ; detected
3 K% M9 x. }  H$ Z1 g' {4 i   push    00                        ; OF_READ
1 \4 B! t, f- R4 C- u2 e2 |   mov     eax,[00656638]            ; '\\.\SICE'$ e/ }% ^  X- F; d: P* B! q
   push    eax( Y- g+ g5 `9 X- v$ J
   call    KERNEL32!_lopen+ z, f& Z, \/ d( Q8 T- q$ ]
   inc     eax
4 M9 V6 T" {/ S   jz      006505ae                  ; not detected
' ~; \$ z8 p) e1 H0 H& J' Q9 w9 R' I, E- B

" ^  a; ~( `5 i. w$ L+ U__________________________________________________________________________
$ K5 D0 L$ u. L7 v4 y; N' X; B& C) h  W2 C6 |9 S3 V
Method 12  y- A. m) l! _! f+ N
=========' s+ s6 E/ y  ]) H. s" z
% N2 H' ?8 f( U# G4 Z/ j6 v( V  C
This trick is similar to int41h/4fh Debugger installation check (code 05
& Q. R- c, R, b4 N7 M. x&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; U8 b! o3 h7 W2 [2 t4 c& f; ~) _, Cas it uses the VxDCall backdoor. This detection was found in Bleem Demo.! o# e9 c, F5 g. l, `% r3 [; w

! z; n/ |  C+ f* a+ b( A1 \   push  0000004fh         ; function 4fh
- |$ |" S/ E. \   push  002a002ah         ; high word specifies which VxD (VWIN32)3 V0 \- T" e; i" ]) t8 S: G
                           ; low word specifies which service
  K) K, r: _; w. T0 ~# Y( m7 G                             (VWIN32_Int41Dispatch)& m, N3 F; i3 E7 D3 V' T! b
   call  Kernel32!ORD_001  ; VxdCall
8 b0 C: z0 [5 @/ ~/ B   cmp   ax, 0f386h        ; magic number returned by system debuggers
# l  p8 }; p2 W& k5 x8 m   jz    SoftICE_detected& w5 Y$ h6 I0 z: v2 A9 e- J
4 G- G0 M/ h# O$ Y
Here again, several ways to detect it:
! `6 A$ Q- E+ Y* Y6 u' ~6 N) K# D. x! |
    BPINT 41 if ax==4f% N$ U  R0 a6 R4 C$ I. x! a' m! z
! G; Y  a7 C5 I% w1 \0 A" Q1 E
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  Q- u2 x1 T6 W# A; u4 _, {. r- S( _" P6 x8 T
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A" B0 \0 e& Q) [$ D/ `2 ^2 G

8 a1 {" f& A) ]5 D1 ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 c: X) t& x  D6 m- r4 w, f3 ~: ?' C
__________________________________________________________________________
  |  [  m) f  l; R( `
8 |( \( v8 O6 _" i# \3 gMethod 13( P8 p0 z7 w: S7 |2 M
=========
1 J) r3 r, h: [9 w& ]8 Q4 T5 J: ?
2 X. D8 p( ]7 `% O) g* pNot a real method of detection, but a good way to know if SoftICE is
) a( R( q$ Y( j* ~, T8 ~2 ]installed on a computer and to locate its installation directory.
. X& _7 W( R& c6 wIt is used by few softs which access the following registry keys (usually #2) :
1 h% p: i' j7 Z+ K: h: U6 J' k4 h0 X( n( K+ Q' H
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
" Y8 B- C8 Y, X4 k0 I\Uninstall\SoftICE3 q) ?$ s3 o! s' ^( u
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, F6 c$ A7 ?5 t% H/ ~  c! ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% S# Y3 T% r1 L! H5 v
\App Paths\Loader32.Exe' |8 C/ i4 d" z- A* ]5 D

. C1 N1 G: [  R. [6 _7 C; Y9 l. K- n' V& [. b; B: k: B# K
Note that some nasty apps could then erase all files from SoftICE directory9 P* {0 z6 f9 o9 m
(I faced that once :-(! n+ Q/ r; L8 e

+ w& c# i% S" Z  \2 AUseful breakpoint to detect it:7 {6 G4 L6 r7 Z+ d% X1 u  b, G

0 v" O2 r, V( k     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
. L- m% |: g' L, X2 G/ G: ~- v1 T
+ f1 J, N( {* [7 O# D6 d__________________________________________________________________________
4 ^+ F9 x0 e6 a; Z: S$ H% K$ g7 l1 P& ~: {- \# b3 f# d

1 p, x9 |( o: d3 T! LMethod 14
  i0 [, d, N3 Q) ]$ p' R=========
/ s9 d6 b) ^: V6 ^4 F4 v) Q8 [
8 R: y" W+ Q$ W& v: FA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose8 n/ y5 q& {/ n
is to determines whether a debugger is running on your system (ring0 only).9 ]5 K+ Z: V( g3 W

- u+ Y3 {0 o$ T/ A- Y! G9 X6 {' z8 F   VMMCall Test_Debug_Installed
0 q2 n0 Z. y) L8 w: O1 @5 U( N   je      not_installed
  O5 ?9 j3 w4 }3 }
/ j0 E. B2 M; [* F4 dThis service just checks a flag.
" T) U+ p5 F8 h9 u, ?7 G5 L</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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