About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 s$ A" N9 }9 n<TBODY>, E: j7 m4 q* {8 Q
<TR>9 b9 r$ w' M" s& q2 z/ F- ~
<TD><PRE>Method 01
, W! j+ {3 G7 A1 W=========
7 i' o. y) ]: l/ b3 O
* W! {( t" @# k; f8 L& z* SThis method of detection of SoftICE (as well as the following one) is
) g$ t& ~; `- V; e- Z% s+ J+ P2 t: lused by the majority of packers/encryptors found on Internet.
- h0 c/ b2 S( o# {7 b- zIt seeks the signature of BoundsChecker in SoftICE
0 p- [% |& d: ]. |* A. f  z$ e$ E% F$ A: P0 G2 z3 z
    mov     ebp, 04243484Bh        ; 'BCHK'
. j7 E+ }+ u0 C; s9 ?: J' Y# X2 }    mov     ax, 04h
! E' b- N# P1 k, R    int     3       ( J; W6 ]4 f- f
    cmp     al,4' ]) h+ Z( c3 `
    jnz     SoftICE_Detected
4 U1 j+ H1 P; s, l8 `+ Z4 Q' i& \% h0 f! h+ X- f/ r
___________________________________________________________________________
& G, {% T; T, F- @% a. p3 \) U4 Q( M
Method 024 |7 r$ V( P8 j
=========
$ L, d+ Y8 z6 n6 v! u  q
; N; }; t- ~, U' g3 mStill a method very much used (perhaps the most frequent one).  It is used
7 `: v/ e4 O: l, B2 j! o8 Cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,, w% R% U7 i2 u: F2 `
or execute SoftICE commands...1 G2 a  Z1 l% |! l& w7 f2 i- [
It is also used to crash SoftICE and to force it to execute any commands
2 s8 n) j( V7 @+ T7 d( N(HBOOT...) :-((    A! {: d! ~4 p6 \: h
0 d. M' o: y- f
Here is a quick description:
; A& f+ k5 E5 w6 @8 L( c4 _-AX = 0910h   (Display string in SIce windows)
4 F) a; o7 J6 L/ k3 `! Q-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  {  g0 e. o3 P6 f3 A4 \0 D$ f
-AX = 0912h   (Get breakpoint infos)* E% w2 T* C1 i
-AX = 0913h   (Set Sice breakpoints)3 h6 f2 s/ a, w- q9 R& ?
-AX = 0914h   (Remove SIce breakoints)1 R# T8 z6 @# l8 ~

: F2 d" K8 }+ P2 V8 ZEach time you'll meet this trick, you'll see:
6 U- [, c4 d4 o, A* O- B-SI = 4647h
% e- Q+ C5 i; d-DI = 4A4Dh
3 O! O, f0 d7 UWhich are the 'magic values' used by SoftIce.
+ K. M6 E: w4 V5 B- M" B# KFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 U% F1 e1 h. ~7 ]

) c) U3 _$ U: `2 P; }, bHere is one example from the file "Haspinst.exe" which is the dongle HASP
; [- A' n# t% U( T. N5 f9 f" sEnvelope utility use to protect DOS applications:( f' l) M, n% ~( X

, Q) _) L& k/ \) {( a( U/ P' G- d/ R' Y) K
4C19:0095   MOV    AX,0911  ; execute command.
" @/ c, s  m, v( [* ?- w4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 q+ \2 M7 z' L4 k, ~, }
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 N( I- a; n3 L  u$ K$ O& A4C19:009D   MOV    DI,4A4D  ; 2nd magic value.; w3 U8 i5 {. [$ C  x
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ g4 g% H) S; D# c7 S1 B- r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* c2 R+ q$ v* D/ g
4C19:00A4   INC    CX
% b1 E5 K, o6 h/ y0 m1 L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- f4 B7 D( b; V$ ~. G8 G- S
4C19:00A8   JB     0095     ; 6 different commands.; n( x9 N+ c5 X5 |% X* S4 R
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 P( X  a( g4 z4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
3 E" n. Y8 S* Q% {$ n1 x
& Y; a) j7 V8 j" T* [The program will execute 6 different SIce commands located at ds:dx, which
6 l- X# `& V8 i2 Lare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 u/ y6 w  j6 W& R: b

5 r- g2 }$ f& @0 Z6 q0 K* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% ^3 E) q' j( @. i# N$ g
___________________________________________________________________________
+ m0 d5 k8 B, Q, f2 ]! \! C. G1 ~/ v; P: C6 v! F

. R, @( [) E8 j7 wMethod 03
) U. D6 x5 @: n% e=========1 F+ @- w/ B- {1 a! o

) `: d2 ]% O5 h$ k" |0 u9 MLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ L! V6 _* ~- [
(API Get entry point)
) X' y; G0 U- a        
7 V' X# T' U9 _7 a0 t& ?& y! }
7 f  }6 k6 Y2 ^    xor     di,di
/ z, _; ~  B& N# p$ s$ b    mov     es,di
, E6 z- Q4 N- b8 `' o, h: S    mov     ax, 1684h       7 q& q" r% R* o! \$ o$ u
    mov     bx, 0202h       ; VxD ID of winice
: }' t  k$ q8 z* G- s    int     2Fh1 ?8 S5 K+ ?8 t# [
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( ^0 z& J! {1 l5 b) x7 F3 n, M7 U
    add     ax, di
; a: |7 P2 y" N& M  r    test    ax,ax
8 z$ ?4 E  H1 Q9 }    jnz     SoftICE_Detected
$ Q0 M% N' c. u
( o7 ^) W. E0 p4 o2 I8 {___________________________________________________________________________4 @$ |( g! p- a, `4 f; E
$ e' I4 j/ U1 a' |0 R
Method 04, X# b4 k. ^& q  o3 \, [  p( B
=========
, a" \0 n2 h3 ?- [
/ i9 v5 `9 g. _5 \) n' a# vMethod identical to the preceding one except that it seeks the ID of SoftICE
7 o2 U) m! n* D% @* c/ D: cGFX VxD.
, E/ M" }) \! l% X! c
, ~9 O! W# d5 P+ i3 C    xor     di,di
; o$ L& G0 |3 y9 }( R7 T8 g    mov     es,di; N1 D  u) y) i
    mov     ax, 1684h      
# ~; j+ U7 i5 E& `9 S( |! l; @    mov     bx, 7a5Fh       ; VxD ID of SIWVID( M" {" E5 p1 S
    int     2fh. ~" @( f! s: n/ Y, L2 I( N- e( y* A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
! d! G6 ]( D2 g/ h8 r' W) m) r    add     ax, di
- S7 ~8 u3 i2 b    test    ax,ax7 B% D9 F5 U: g' Y7 r
    jnz     SoftICE_Detected: `& \# E  ~$ p, Q

" a% G" P* u3 w( D+ n6 J__________________________________________________________________________
" W0 ^% C3 z! Z3 U( V! j  S9 R( Y- c: L, V1 P8 q& c

  }6 k6 b6 X: x# dMethod 05
$ Z7 u! k7 O( _! L# @* s* q8 E6 ~=========
) f8 |- {  J* b3 p
/ ~4 x; h0 r$ w7 o; SMethod seeking the 'magic number' 0F386h returned (in ax) by all system
" S: }2 U( L# l! C8 K8 Q, w; K6 E6 _5 Hdebugger. It calls the int 41h, function 4Fh.: E- P" V" k1 ~
There are several alternatives.  4 Y. n' M" g. j
8 \$ G% A5 y' d2 i6 d
The following one is the simplest:
" N/ T% y" G) d
" ~2 p# I9 w* T, q5 z    mov     ax,4fh
9 q6 s" w0 o# j% V    int     41h
  X9 `8 n( b' D/ S$ e, I8 v    cmp     ax, 0F386
; l/ H) `6 L# V" q8 q) @. s    jz      SoftICE_detected( f% w4 u2 h# A8 e& a8 F
+ f2 b* y) z' [, w. a

& X0 V- v# |! g) i. a: Z, b7 ONext method as well as the following one are 2 examples from Stone's
9 E. U* G9 u) t' a1 i0 N"stn-wid.zip" (www.cracking.net):: V4 Z$ k- m$ K  M! d' O: d- v/ k9 V# _
$ \# x  ^$ z5 z  j. B
    mov     bx, cs
" j5 d7 b' U% R    lea     dx, int41handler2+ f7 w5 T7 M* q
    xchg    dx, es:[41h*4]
9 a' c2 T+ h9 v    xchg    bx, es:[41h*4+2]8 \8 j; X1 |# {& q5 y' t+ _
    mov     ax,4fh$ B, B0 U& z* u6 X3 i; V* ^6 u; x
    int     41h# R0 \- k# d' w
    xchg    dx, es:[41h*4]
" k4 Y( l0 L5 A' C' h+ s    xchg    bx, es:[41h*4+2]
5 e) g* [+ [# e! A    cmp     ax, 0f386h
5 l) O) X! ~4 G" d: v% f$ m    jz      SoftICE_detected
9 \9 X/ \) A3 K, X$ l& S7 N
3 Q- d; j7 F) ~, lint41handler2 PROC
7 ~5 ]0 w6 }( u    iret2 s6 U$ n  K9 @4 ^
int41handler2 ENDP
& i0 _+ Z1 r, }5 d, }
* U8 l. o! e3 }, [8 l# y; U- H5 I- @/ Y* S8 Z  l- f1 o
_________________________________________________________________________/ f) N' \' t. c
$ e2 f+ M" o! {
5 S9 U+ M, R8 \0 ~
Method 06
( T2 H4 X+ V( A=========+ M$ @2 k! U1 V( L
. W, i  D  [7 }$ [

3 r2 U, r; ], ~, B6 j6 \* {2nd method similar to the preceding one but more difficult to detect:
  `8 X" v; B& [
, i) \" b# d: [0 ^7 ?; w' Q" H3 h5 y3 W
int41handler PROC; j; X* ]& G) k% o  k" l  s
    mov     cl,al
5 M0 q+ Z7 V9 A: [" _) ?; {2 D    iret
: s, T; f; O: q- kint41handler ENDP
) C8 M$ w# Z! B/ E& @4 _2 i
0 Y) P. Z* o2 u2 l: d6 r/ y# T8 E5 u1 u
    xor     ax,ax
# V% F+ U, J# H3 Z    mov     es,ax
7 g/ S2 r- j5 X    mov     bx, cs
& s8 t$ h$ b- c! l    lea     dx, int41handler( ^0 r  Z" E8 s- P2 P/ M
    xchg    dx, es:[41h*4]
% ^; q* v) E+ U* ?/ r    xchg    bx, es:[41h*4+2]7 m% x- j: v0 m- a% `
    in      al, 40h
7 s7 q" |" _( K/ @5 y3 Y    xor     cx,cx
4 ^. A% y8 W1 A, M& f    int     41h$ j1 u7 ]* k) b
    xchg    dx, es:[41h*4]" _( x! @3 R9 F
    xchg    bx, es:[41h*4+2]$ ^, P+ t- @' X! |0 T
    cmp     cl,al( f" i& H2 i2 D
    jnz     SoftICE_detected- [* h/ v7 F* [4 p/ r

: R9 K- m4 M7 M9 i_________________________________________________________________________
% w) t% }2 ?7 c8 O6 N& _3 p% ~; |8 l/ g' [  i6 S# d: q/ B. E; a
Method 07" z; T: p' g9 f7 {
=========( j( E) N5 `( }& G  w0 _/ x

4 |2 t- e* i  Y) D, AMethod of detection of the WinICE handler in the int68h (V86)" L. f! ?! p0 Z: S/ g3 k" S

; x$ V- B% r) w- p5 j    mov     ah,43h; g' W4 i+ R- }% d+ d
    int     68h
9 J9 W. O: m4 b( Y' [9 L    cmp     ax,0F386h" {+ G  j6 O8 Y6 K' G& `5 I1 @
    jz      SoftICE_Detected
/ B' B5 r( L- V, g7 d/ \% v. ]

, _% t- d& u+ E8 R8 O=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 u' y$ m4 ?' C; d2 Q   app like this:$ B) N- U- C$ h. {, o7 p

! l6 P+ C$ a5 Z, n: p. P# Z   BPX exec_int if ax==68
  S* ]" A. ~2 j$ D, D6 k5 F   (function called is located at byte ptr [ebp+1Dh] and client eip is- B' g+ f4 v" T+ a. X/ Z) g* T
   located at [ebp+48h] for 32Bit apps); ~' g6 r' K8 z) o* u; W
__________________________________________________________________________
4 j8 m) g4 I6 T% t) v6 V' M! _' N( s& ]: |) M, W# s
' u. h9 k$ X6 a' m" v
Method 08
1 G8 f+ h7 Z' L9 Y' a=========
2 i8 F. P5 Q% G, C9 L0 c
- }2 ^4 }" ^) G. A% _It is not a method of detection of SoftICE but a possibility to crash the
( k& f6 ~  `9 T/ v! asystem by intercepting int 01h and int 03h and redirecting them to another
2 ~9 A. t% u/ \( D$ t8 Aroutine.8 S5 ^6 k: S1 j! M9 ?; Q1 {5 N1 R$ ]( C
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
! y) {# S9 j. y, i7 sto the new routine to execute (hangs computer...)
( e# d* C3 i0 f, x; q! y3 u
# V4 R" u/ w; |1 a' Y* Y    mov     ah, 25h0 \* n5 [3 h2 h
    mov     al, Int_Number (01h or 03h)# S0 [4 d- S' Z9 {2 I6 l1 O
    mov     dx, offset New_Int_Routine. d: A/ W" i* x  s5 R2 x
    int     21h
* J, ?1 p# [- {& F( M8 Z% y4 B. X" G
, I1 ~# o9 A* K% {1 T2 o__________________________________________________________________________! |4 h3 v1 l6 h' x% D, O/ e
2 B. S' J4 M6 N! J) _  O* a2 B
Method 09
& D* j0 F9 c, O8 t5 l, y$ O5 G=========
  J9 W% r) h: q! H# j% Z. ]2 U9 w0 u5 M1 X7 J  k* U" M$ n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 i0 ^* ^) F% t0 F8 X. m$ B& M  y8 u6 Q
performed in ring0 (VxD or a ring3 app using the VxdCall).
. n8 ^! I3 P2 V) Q% E! TThe Get_DDB service is used to determine whether or not a VxD is installed% g" _5 \! x& F- j( T
for the specified device and returns a Device Description Block (in ecx) for7 V6 E. G$ B' S' A% N
that device if it is installed.9 O+ S# |6 X. w/ S0 s
/ L7 p9 h* n! W
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" Z9 b$ x8 {8 F% R; x8 R3 _3 I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): J" [5 ^4 ?' v
   VMMCall Get_DDB: e/ V4 c7 N' F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" a' U% U5 ]6 Y  M/ a( ]+ i; @# z4 v7 }6 I1 Y, N% k" f
Note as well that you can easily detect this method with SoftICE:
( N: y6 i8 f) n$ b6 \1 d: [/ F   bpx Get_DDB if ax==0202 || ax==7a5fh% I$ R3 a' C3 O: B

8 u9 l' v: b% ^9 k: N; Q3 }__________________________________________________________________________
7 U8 v4 U- x) [8 ^/ O8 D* T; q" |: b! C- m
Method 10
$ K3 \4 [4 {% S, p=========
5 W# C' w& A, Y: Q' X- I0 Z2 Y2 @, B7 T% j5 i! c
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with2 U& e8 s1 p0 h" F) {% T& M
  SoftICE while the option is enable!!
2 G, ^" {- u1 i/ D7 Q+ g) ~4 ^- G$ a$ q. A) c" {1 F* e/ ]' B
This trick is very efficient:: M, C6 s" u6 w1 P
by checking the Debug Registers, you can detect if SoftICE is loaded- V5 n) x5 d! r; z7 u, [: \  Z, @
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ O0 ?! B  L' U, Q1 e
there are some memory breakpoints set (dr0 to dr3) simply by reading their
3 r! e- J5 V0 |! {value (in ring0 only). Values can be manipulated and or changed as well; `6 ^' o* v" |/ A
(clearing BPMs for instance)
& h, R+ G/ B) }2 V4 H+ g! u* V( _- f7 v8 U! O5 c) z
__________________________________________________________________________% y2 i4 R% D1 {  J# A' k- Q- G
9 j  g2 T$ q- U% Q
Method 118 P* a2 B- z9 P. \+ ~& q) l5 E
=========
' p, D7 ~/ J% l+ u3 U& B3 V5 F4 K+ e! n& X1 H- a
This method is most known as 'MeltICE' because it has been freely distributed
/ Z, n' }; Y9 Xvia www.winfiles.com. However it was first used by NuMega people to allow
, A" n7 ~6 V/ G$ j- M9 }; lSymbol Loader to check if SoftICE was active or not (the code is located) M( U. I) c  B* V: p; |
inside nmtrans.dll).. |9 W/ [, e- u6 i

, s6 S% V5 Z) t3 l& T* N7 ~( N8 W9 N; nThe way it works is very simple:5 V4 ?+ {) h3 `+ k. i$ y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! c8 t& i2 P7 i; ^$ B
WinNT) with the CreateFileA API.
2 _1 o/ G* u* u+ L  f. T7 g
, m( I5 K9 Z9 j" u# b$ g; h8 ~: vHere is a sample (checking for 'SICE'):
0 a  Z) G( |) d; E) n" Y- a  I7 L. B$ c5 X8 I) m
BOOL IsSoftIce95Loaded()
* _" A! u) b! B1 {{
( f& P7 O, b. }! e: C2 W; a   HANDLE hFile;  
' `, a, `+ R2 H) U+ F$ P, w2 T. F* _   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; W7 L; p7 v  e" G
                      FILE_SHARE_READ | FILE_SHARE_WRITE,* H' h( Y7 [4 W" H- y1 b5 u! @
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
% z0 P7 w! E' F& i% d   if( hFile != INVALID_HANDLE_VALUE )0 L2 h" p; T$ F
   {
1 b; G- D& u5 c      CloseHandle(hFile);5 U  j, a5 F; r0 L$ t
      return TRUE;
* _8 Y9 o( X. B5 @" W  {  ?   }, C9 R6 S$ I1 \) ?3 q* ~# S7 O
   return FALSE;
0 F# ], U4 f, O& I6 S# E  Y$ Z}& W: `. R3 ?: A! {5 r$ K
6 H$ N) d7 l* r, c6 D7 j8 x
Although this trick calls the CreateFileA function, don't even expect to be
5 \5 d$ M& T9 v* ?1 ?able to intercept it by installing a IFS hook: it will not work, no way!/ U& K4 j6 O$ O; [* K  l
In fact, after the call to CreateFileA it will get through VWIN32 0x001F8 D, N9 Q2 N. J) V( @4 ^3 W
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 |4 X* i6 ~$ e9 A+ g3 ~! T
and then browse the DDB list until it find the VxD and its DDB_Control_Proc: u) I  A$ p* ~/ m! J
field.- Z4 X  _6 A* r* n, P
In fact, its purpose is not to load/unload VxDs but only to send a 3 W9 R% }( `3 f; d: b3 {6 P
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)3 z$ u; W# P5 O5 n  u/ e2 X
to the VxD Control_Dispatch proc (how the hell a shareware soft could try& b# a* m* H3 ?# a) Z+ f3 B+ D) F
to load/unload a non-dynamically loadable driver such as SoftICE ;-)." x/ @. @  W9 p4 m6 ~% g
If the VxD is loaded, it will always clear eax and the Carry flag to allow
: J5 W8 u* x6 mits handle to be opened and then, will be detected.
0 F1 ]; v; B; M" t* K3 @You can check that simply by hooking Winice.exe control proc entry point
1 D9 s& |& R( n& owhile running MeltICE.% x! V; r- Q6 C

: S0 P7 }& S6 m4 D5 N: K3 j" W9 H5 D  I4 r$ O6 J$ d  R
  00401067:  push      00402025    ; \\.\SICE
. v" S/ _6 m$ Y' s  0040106C:  call      CreateFileA
1 G% `" I, n; s  00401071:  cmp       eax,-001
. Z0 G8 V+ @$ |2 s/ m5 ^  00401074:  je        00401091
" Y5 s  z% C0 L* v4 I( s4 L; {) j6 t6 z; H% D$ |, p3 P

0 ]1 ^% C7 z! F, AThere could be hundreds of BPX you could use to detect this trick.1 n' Z3 [. Y- [
-The most classical one is:( n5 X/ l/ a' b0 i" E& H( x5 }
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 U& `8 U7 t+ p) q; t' y' q( ~; G% U    *(esp-&gt;4+4)=='NTIC'3 r2 h" h: Z4 X+ [8 O' q/ Z0 o: ~9 E
: d: P6 f. n7 N2 y& b& g3 Y2 C8 t
-The most exotic ones (could be very slooooow :-(
/ }) t( o6 i8 x' k   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' f( T3 d7 L& |4 }
     ;will break 3 times :-(
# a6 U9 U' j: s2 K3 w9 ?
4 K% s0 u* n4 @, }-or (a bit) faster: 2 `! Z, b' a( z; q* ~6 M
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 J! A% t' t4 u7 p) B7 `8 O

$ h, A9 p5 \' G9 ^; e+ [8 }) ~9 f   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ F3 R& B) R3 L' w7 B# |9 P( ^
     ;will break 3 times :-(
1 g8 B. ~- S  |6 s6 v  i4 w- I) t: C4 P2 d
-Much faster:
8 i4 q& _0 r- D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
, w; Y3 t# H7 N  F( O4 ], y& q0 K! P
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 W8 D6 Y5 s5 v$ gfunction to do the same job:& H/ `3 S# E' B
( G9 c# @2 u; m+ M* r1 d2 ^1 r
   push    00                        ; OF_READ! {: U9 q5 C9 f% g; N' K3 i4 p
   mov     eax,[00656634]            ; '\\.\SICE',0
) D* |9 i0 |# Q. z" s- N7 X   push    eax
2 l+ E8 T* Z5 D1 Z2 ]( q   call    KERNEL32!_lopen
2 z* U9 x. {4 V' n7 p   inc     eax! |5 |5 G* f* Q
   jnz     00650589                  ; detected# p. Z/ C; {" w7 e1 }# q4 n* Z
   push    00                        ; OF_READ) H' T0 ]/ ?' |  \; o
   mov     eax,[00656638]            ; '\\.\SICE'
. |, q, E! _: @1 L   push    eax
& }/ G5 D5 D3 R4 I, ?4 v   call    KERNEL32!_lopen+ r5 _  k) b+ h% \3 X
   inc     eax3 D& t) o9 O  `( F/ N2 B
   jz      006505ae                  ; not detected1 ~' w8 H1 ?4 W! g! m  ]

* `. J) N$ L9 s3 T* o, E1 X( K5 N2 u: K4 W
__________________________________________________________________________1 `! W4 l: Y4 W. D

- {6 S: p3 a* V7 d3 C' dMethod 12
4 R6 R, ~! d7 ~4 |2 w7 J=========
/ u# j8 w0 r1 U0 p+ n+ }
# H% W5 m5 ~9 C2 W7 q7 RThis trick is similar to int41h/4fh Debugger installation check (code 05' _5 d5 e. o, x4 z. e
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 z! x. P1 S+ O# g" \, s/ a6 eas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
, F: J3 C9 g# G$ {1 t# q6 V2 d0 u+ T' B- l* m0 J( e
   push  0000004fh         ; function 4fh/ z! ?6 D& _# F! r
   push  002a002ah         ; high word specifies which VxD (VWIN32)
! |+ z  J9 n0 ~9 ~8 J                           ; low word specifies which service
+ m! a4 M, j! J, k" z                             (VWIN32_Int41Dispatch)
2 o: ?% j0 f0 F( d   call  Kernel32!ORD_001  ; VxdCall) l7 k! ^7 S3 u; j* T. L2 C3 D
   cmp   ax, 0f386h        ; magic number returned by system debuggers2 f7 M5 K( l+ v2 ^/ N3 A) q
   jz    SoftICE_detected! o7 B7 p) e7 D

6 O0 P8 o: y2 lHere again, several ways to detect it:( C( i- p( ^8 z; n

2 o8 |/ s8 \$ J, y    BPINT 41 if ax==4f& R( h0 i. c) X* o- R

: K9 u- w2 I/ X) T7 [    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 Z$ k% I  B  g1 P& L

  y8 G9 v0 \/ q    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 y/ M9 P5 E9 M
3 c! O# z+ D* V
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 ^& \8 @1 H5 B* ~
$ x/ u9 @# h. H5 X0 a! w0 B+ f& Z. ^
__________________________________________________________________________6 L% D& R7 q7 Z8 H: w6 w) t! i

" x7 ~. N, T5 a2 V; J, _5 xMethod 13
& ?, e/ L! ^3 m- V8 F8 C=========/ `) i/ q; \% J+ A

7 V: P3 s( P0 x( C$ y4 ~+ Z" |Not a real method of detection, but a good way to know if SoftICE is0 U4 H" d* o/ n8 G
installed on a computer and to locate its installation directory./ \, V  i' C* K% C
It is used by few softs which access the following registry keys (usually #2) :. W6 S( p2 F& O0 G

1 K. o: `/ f, ]# H  m" g" B& y-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- S$ `6 }7 L# o2 l& |\Uninstall\SoftICE5 T7 W, p! y( o7 Y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE. B/ J, \# N) O# Y/ w, J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 U3 p) a$ Y7 `; D\App Paths\Loader32.Exe4 ~; r: c9 F# P% C
( b- }3 O* B; s
5 W, y% r9 x' X/ U1 _2 _7 s; r
Note that some nasty apps could then erase all files from SoftICE directory
8 ^- L2 j2 x; A$ D( I1 ~$ [2 U(I faced that once :-(4 C  U% `7 u; `5 G& i

: X) W" z: X4 H9 x, V9 D$ i. bUseful breakpoint to detect it:* x  V6 i3 q  A( S+ A) C

( [' j8 G# z; x4 i1 F5 y: D     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
/ x6 Q' l' e: [! h- Q- p
. U' Z% k# c2 y% |( D$ a__________________________________________________________________________
3 E. Y3 P9 P- }! [: z  _! r/ c, }8 F' ^& m! b
$ M/ f0 O6 v/ a& A
Method 14 " K- Q. E+ u6 n
=========( E" f: f+ \/ F- c

; Z* o0 m& j+ Y$ f/ [6 w2 j; wA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) }5 n4 P3 Q/ o) ?9 s4 Ois to determines whether a debugger is running on your system (ring0 only).
: \& g4 P  B" I4 O6 U$ Q3 \: q8 C4 o- z+ q0 q" O
   VMMCall Test_Debug_Installed* C/ K9 p7 Y  z8 Q6 H
   je      not_installed
; D3 S+ @2 v. a) S$ R+ s) {8 P/ |3 l# t7 o- q
This service just checks a flag.
6 J. a6 N6 k3 T# y6 u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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