About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, H7 {2 k" l6 s- |5 s; M* z<TBODY>' A+ t7 u! i0 G, w/ [3 U- J
<TR>
9 ~; d) s% v3 O8 I6 g<TD><PRE>Method 01 8 S/ d6 v, j+ }+ ~7 R
=========+ M, g9 x; t& p9 J

# E- h& E3 Y' a9 d8 {/ O; F8 MThis method of detection of SoftICE (as well as the following one) is
$ o4 v& y  b+ L) G* N7 F+ X1 Qused by the majority of packers/encryptors found on Internet.
0 h0 }: B: u" p+ _# dIt seeks the signature of BoundsChecker in SoftICE5 G' l8 Z* O8 V+ d+ e

/ F6 J" R: F6 R: G! S' K7 m    mov     ebp, 04243484Bh        ; 'BCHK'
3 X5 f  N6 z6 l( S1 q" @    mov     ax, 04h
/ A- B& D) ~; Z    int     3      
4 @2 U& T6 \# A' ^$ z    cmp     al,4
; W9 u& J1 L5 V: s    jnz     SoftICE_Detected
! c% ?5 K# V% U! f# V
- P2 c. N) p  a___________________________________________________________________________
" Z, i4 Q8 U: j( I7 r* O# D( t
+ x: K5 x* M2 J6 e# `Method 028 q* j. ~" R  U, v' g
=========$ q) b) }) l2 ]6 T; l' O- Z& U& I$ L
; }+ [' w, v7 T( M  T8 W" x6 j
Still a method very much used (perhaps the most frequent one).  It is used
  w' H  S% _/ Q; \! uto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
% w% @6 A% V  V8 ior execute SoftICE commands...6 r  k" A  j7 _" V' I
It is also used to crash SoftICE and to force it to execute any commands
$ q9 l- W6 k) V  x7 S0 n& Z(HBOOT...) :-((  
% R/ W4 q) s! |0 |% ~( X8 g
; a. d5 a$ g. {/ R! h# i/ O9 I7 xHere is a quick description:
& P2 }1 j8 i+ |) O-AX = 0910h   (Display string in SIce windows)
7 B2 ?+ A1 i! Q2 {3 K# r) m-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) N. N$ e: s# K  w. h* N  }-AX = 0912h   (Get breakpoint infos)6 N5 R1 I, f. x: i$ B. u
-AX = 0913h   (Set Sice breakpoints)
, i" q% b6 A' ~* Q+ J-AX = 0914h   (Remove SIce breakoints)( O" ~" d2 C2 Q( S
! P0 z1 B2 O5 e3 k
Each time you'll meet this trick, you'll see:6 s- U+ ]& R; }0 c0 H
-SI = 4647h
% |* T* r4 n$ L-DI = 4A4Dh, m( @/ N- h1 d. h7 D1 v; I
Which are the 'magic values' used by SoftIce.
! P5 F; @6 k" vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, q$ D3 y6 Z, S5 l& e9 [; y. U% s7 H7 q% Z8 L2 |: w
Here is one example from the file "Haspinst.exe" which is the dongle HASP! l8 i  B% T) m$ i* E9 _
Envelope utility use to protect DOS applications:& m! q% |7 ?( n' q+ z! @
, G- Y. q3 h' z+ r( X# W& f1 T
3 m# o/ ~. w! ]$ t. `8 ^7 A
4C19:0095   MOV    AX,0911  ; execute command.
" n8 t! \$ v# }; V- Q: L$ a4 Z# l0 H4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
( x$ l% s( t" i! H2 H  _4C19:009A   MOV    SI,4647  ; 1st magic value.
1 d/ G6 n/ {; B3 |4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. G# ]5 e* B0 y2 I- Q0 M2 Z* f; X0 w
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ l' L/ }/ u% S# F4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
/ Z* h1 D& {  _, o3 R# [" ^- d4C19:00A4   INC    CX
8 U3 \, @$ z: K+ L, |4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' v/ @: |, b" I2 k5 a- ^# Z0 J
4C19:00A8   JB     0095     ; 6 different commands.5 T8 S: ~# v- X3 L  \2 g1 E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* A6 c" X, S; \: x! F" S4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 ?/ {& m; k, [1 Y9 i$ b+ ^6 c( B5 \, m$ C: ~( `2 ?
The program will execute 6 different SIce commands located at ds:dx, which
! O- O1 M' a8 q* x6 w% care: LDT, IDT, GDT, TSS, RS, and ...HBOOT.1 E3 x) h* J8 N: I( L3 R

) m& J( B5 [& ?* d& z& h* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# f# B& _0 m8 D5 U) @& I1 z. a( _
___________________________________________________________________________$ U2 C- t) p' d8 q+ e  J% u

7 K. R4 R& X3 T/ L1 S& A* ?/ S5 q0 G$ j( ?
Method 03% a6 _2 T5 c* N: t6 Q& @0 B
=========* N+ C- W) k+ M2 f4 m

) M1 s! N5 c( v8 fLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 c$ P. S# d4 s2 n1 A(API Get entry point)
' y! ?' w/ L4 Q# A        ) G8 C2 x" }1 G6 `7 O5 m- n/ Q- }
( ]9 n2 P4 C+ \/ S
    xor     di,di
* ]8 k8 F5 c% v$ B/ F+ `    mov     es,di
% G0 U, I) I% ^! h  r0 F    mov     ax, 1684h      
- u7 @" `! Z7 o% m0 e2 e    mov     bx, 0202h       ; VxD ID of winice
9 U( [% `& ?+ T2 Q8 ]) U7 x    int     2Fh
6 O9 l+ r7 ~& @8 J+ w" k( T/ z0 W    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 Y9 u3 e9 V& l
    add     ax, di
8 Y8 h0 Q6 w+ l! G    test    ax,ax% H5 Q4 c7 A6 \
    jnz     SoftICE_Detected
( M* T% u# X# {9 ?( ~
( v% L, Z& C& [, _# K___________________________________________________________________________( R6 r7 a4 q# g8 V1 z* `8 i

# e- i6 D* k( W/ d6 s; aMethod 04
; B6 P" `- G8 Y4 T7 U=========
- W' [2 ?( x, C! b2 h9 i/ p% {( i( c% b( H4 t- L
Method identical to the preceding one except that it seeks the ID of SoftICE6 ^0 F* M0 r& H# s$ Z7 p! s- a
GFX VxD.6 u; S. A/ t' j; S2 V( w

) N) f5 j2 Z4 p+ M& k5 k# {) v9 f    xor     di,di2 _* g0 O3 N5 @1 A
    mov     es,di
; ~3 ~  X; Q( s- i    mov     ax, 1684h      
* r$ @5 N  ]9 |  {8 P    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 P1 f5 p5 l; q9 F1 O" O9 u    int     2fh6 F1 R" J5 f) p" J, y" c% @
    mov     ax, es          ; ES:DI -&gt; VxD API entry point  j/ \) z, W$ v& a! O
    add     ax, di% ~& Q- K4 }" h# h) b, Q
    test    ax,ax
1 j0 I# u% h; Q/ d" e1 C    jnz     SoftICE_Detected) C0 c. k+ q# s/ X

2 S% s9 g. Y/ O0 C) c% S2 Q__________________________________________________________________________( {8 v. z+ D& K1 I
: D# {( E& e. q) S& ]

" s4 q" u( j/ sMethod 05
$ d3 U9 R+ }" U: d4 g=========  s7 a7 A- N! H' d2 y

* M. U/ J2 z5 s0 cMethod seeking the 'magic number' 0F386h returned (in ax) by all system
2 q7 r  {9 j) a4 h9 }debugger. It calls the int 41h, function 4Fh.
7 k) h" ?$ V* z" e  M' IThere are several alternatives.  
, {6 |! q( h" m( d/ V( x+ M' x0 c" P% Z8 v
The following one is the simplest:& ~7 w  `# o# E+ ^' x' k

8 s1 Z& c/ H: `- q& y" m6 ?. ^    mov     ax,4fh
. [6 F4 N  c$ t3 ^! ]    int     41h
- X' K- M; [' u" E  X    cmp     ax, 0F386
' U* B" N1 |/ s9 t4 ]4 t) i  V    jz      SoftICE_detected. d, V/ q/ M. K5 g! u2 f! L* ?

" w8 n8 e9 v/ ?  f: J3 d- K/ r' }' D4 J2 `3 @
Next method as well as the following one are 2 examples from Stone's 8 c( b* h$ n: a0 h
"stn-wid.zip" (www.cracking.net):
9 A6 s. V9 N7 Z
  D9 J  c( W+ X% H9 ^, t    mov     bx, cs
8 E. y- z- e, `- a    lea     dx, int41handler25 r4 a5 l& N( z5 a
    xchg    dx, es:[41h*4]# w0 O; _+ f0 S6 v6 n( E' y) X9 @
    xchg    bx, es:[41h*4+2]% e' X& e% D4 M
    mov     ax,4fh
7 C: J3 r5 J- n    int     41h
9 |1 O8 |0 F& d7 o/ V    xchg    dx, es:[41h*4]
% k/ J6 o& C8 `1 Z9 @$ K5 @    xchg    bx, es:[41h*4+2]5 @9 X% Q& S& V' \  }
    cmp     ax, 0f386h4 v* w2 W6 S  A  D1 A0 h
    jz      SoftICE_detected
8 A* L- n2 [1 K8 L0 k( a" w1 v. T% r! `" J
int41handler2 PROC- v3 N. v. v" R# J. W8 ?
    iret
* M. N8 S- I( M2 t% j3 Y2 u( }% [int41handler2 ENDP
! D* N1 L' y$ e' b' e' E$ P' [$ G8 G1 K
  j- p: d! D8 o8 f8 C
_________________________________________________________________________* Z4 w; E2 M- L% D3 w/ [

7 q5 V. r; t# o9 r* l3 k: J2 ]
/ h8 S. a! j7 D- @  F! \Method 06( H. F' m( C1 i# W! Q
=========
3 O5 ~; w( W# r
% ~. t9 i4 K9 f/ t, V# c3 i& p3 H, X: U
2nd method similar to the preceding one but more difficult to detect:# `! |2 E6 U- L9 P5 B
; n4 X  d2 }, W  _8 h/ h

! O/ w- X) c5 O4 A+ V7 [int41handler PROC2 U0 ]" x0 W) x; ^+ q. \: H
    mov     cl,al4 o  v5 I: v7 p% X9 h0 W0 x6 \
    iret
1 g9 K) D3 {& L# |int41handler ENDP
! O0 x# M9 ^* w6 v: E- Q0 L' Q8 ?) }9 z- Y/ [4 z3 |( e

7 I: N1 Z4 f& A3 A    xor     ax,ax% P& J! Z( d$ V2 {: G) l" y- b
    mov     es,ax$ K, l# E) {" J! x% l4 ^9 z- w4 n
    mov     bx, cs! u% @. U/ N$ k8 \: ~. [
    lea     dx, int41handler
9 Z5 v+ s0 H& _) v  ^  J/ w% \' F    xchg    dx, es:[41h*4]
2 n+ m7 B; a: b0 p9 ~8 w    xchg    bx, es:[41h*4+2]
. M. X2 S) r* I% P( _/ _6 `+ g    in      al, 40h
% ]* [3 q% X$ Q3 T! d6 q! S    xor     cx,cx, q9 v5 z/ @' j3 N% i& [3 N
    int     41h
* E! I5 i) c! n: h    xchg    dx, es:[41h*4]: q) ]$ @- W: U( N; T$ {4 g
    xchg    bx, es:[41h*4+2]
& h% C6 k. s* s. E    cmp     cl,al) l+ w" B2 S5 X$ N1 X
    jnz     SoftICE_detected% o( M; O" V, j3 e2 K1 a
: r" e  e# f, W5 z) A: U/ L' U
_________________________________________________________________________8 N6 x- v+ I* h; \
/ V% p) {' J1 ~0 C$ s" S
Method 07( ]" r# @7 N* b, O) b
=========/ p/ Z* y; y% I0 N" s

+ q' w- f. g- P+ }* hMethod of detection of the WinICE handler in the int68h (V86)
  r+ Y0 s" p" Q2 Z  a
" e$ \. @! u* i: |% k6 P  k; Z    mov     ah,43h
: V3 w* m. k' |6 e, y+ c    int     68h
" @; \9 {& t% U. p: l$ D; a    cmp     ax,0F386h
5 @2 D& \' i8 ^' A% q( n    jz      SoftICE_Detected
) Q, Y+ q+ y2 r( s7 H
0 r8 S) F, ~! {2 d$ m7 G7 @/ W7 V3 A/ }# y- @. ?/ W' O
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 {) \% `6 i: _; F5 D# M   app like this:; N7 Z/ v5 h& p/ u5 l

" k  j/ t, i* U, j) p   BPX exec_int if ax==68
* |- O* `( I; \$ k4 L   (function called is located at byte ptr [ebp+1Dh] and client eip is
: O; y+ L6 w, _# Q1 F9 K   located at [ebp+48h] for 32Bit apps)$ d8 F9 {! z3 W+ D# Z  |
__________________________________________________________________________
& g. H& }8 I+ K3 s$ k
  [, Z1 W6 {/ d1 d: l( D4 m0 H7 k
2 d* r; g$ J  sMethod 08
0 z" a: W. J& J* i* o=========
8 \+ i. Y* d' R9 X3 ]$ e4 c4 R1 F% m6 @" {& O
It is not a method of detection of SoftICE but a possibility to crash the
+ g5 Z& q, \0 r5 L9 W5 i; r2 Vsystem by intercepting int 01h and int 03h and redirecting them to another; }7 L9 u" [: z
routine.) |. e9 W3 k/ [9 r9 y  J
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
- |3 A0 }* A, ^3 Uto the new routine to execute (hangs computer...)
7 U( O) s0 `' ?# C4 y6 g) [% \! t& }1 j. n5 y5 S: K# M; u5 f
    mov     ah, 25h) {) Y  T" p1 N! r" y1 ^
    mov     al, Int_Number (01h or 03h)1 j- V/ N( W# J* ~2 }: g, n! F* I0 X
    mov     dx, offset New_Int_Routine" B8 O/ N: \# P4 i
    int     21h
2 S( w  [! Y# l
- O, }( R' H) p1 }+ _; g& r7 W__________________________________________________________________________1 [/ `/ r! j4 x# [7 R; t& I2 B& b$ m5 g

2 X+ U2 P) U: B8 c9 h( TMethod 09
: U1 j& x  v) d/ B0 L5 q" }=========; S/ S$ U! b5 X1 e) D- s5 H+ m* V

% W0 G5 c2 T; ^8 bThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 _; |) @0 J* z% Y4 R+ G& Xperformed in ring0 (VxD or a ring3 app using the VxdCall).
! ~" c0 M" T. ~6 g3 Q+ w! \The Get_DDB service is used to determine whether or not a VxD is installed
/ E( v1 m( T# t% |. }5 S! Wfor the specified device and returns a Device Description Block (in ecx) for
5 W8 [4 A; V- t. Y( qthat device if it is installed.  U  G' Y" a7 c9 J
2 w( j' W: k7 O8 i8 V7 J0 M' g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID4 W7 d6 N3 M5 e  w
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)% v' v1 Q* \8 p4 A
   VMMCall Get_DDB1 P( Q2 V% w/ C8 I
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  h: p0 y. k' R: v4 P$ x/ K
. J) H! e4 E2 D6 W5 x2 ]
Note as well that you can easily detect this method with SoftICE:9 D3 E: W9 u8 r7 ~7 H9 O) A9 R
   bpx Get_DDB if ax==0202 || ax==7a5fh
& A+ M6 ^' s1 c: k4 L9 u0 z3 A& ^- I
__________________________________________________________________________7 ^" ^0 B& R" k* p

! }7 Y7 \& X# a; Q& |: y% f& Z- yMethod 10
4 q& W) Y) I  h; u6 C=========% |$ P0 V0 @5 U1 d2 y+ `

! l# y$ X% p8 N. l- i* n=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 v* Q, S- _' O6 L# K0 w: B  SoftICE while the option is enable!!$ r1 @$ f7 {! `; k5 K+ T
6 m5 m" _1 ]/ [' E
This trick is very efficient:
9 w5 s3 Q) c' `" w# `0 D' z) Jby checking the Debug Registers, you can detect if SoftICE is loaded
! A/ |9 q2 J: E1 G' R$ P(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 O. ~% r1 k1 f/ j  uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
* d* n5 l* G' ?( Nvalue (in ring0 only). Values can be manipulated and or changed as well
7 h: \# h5 ?; s* w  ~# d# p(clearing BPMs for instance)/ S2 ~" u: J6 y7 Q
8 D1 d3 {: f2 R( k& X, G
__________________________________________________________________________$ @3 l8 i+ E9 Z1 {
% H2 Z+ }4 X, s$ ^
Method 11
. B7 T% Y6 h% D- c  O% Q3 z: i=========
" C" L; @( s7 h$ h9 K: P" X- J
: d! l" H. x6 x8 YThis method is most known as 'MeltICE' because it has been freely distributed
! M  s! ~* U! ?6 `- Uvia www.winfiles.com. However it was first used by NuMega people to allow
8 s) a6 t9 u; @" LSymbol Loader to check if SoftICE was active or not (the code is located, b0 \+ C  J# [$ `- \
inside nmtrans.dll).3 |7 n% s' A6 i( W6 a. `6 C. l3 c
: c3 o4 ~& O' a, g* H' P
The way it works is very simple:
$ l/ m" M- _$ p/ ]# `It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for& ^6 u  {* B5 i
WinNT) with the CreateFileA API." a3 ?% j" B' Z- f

" I3 ~  E6 u( fHere is a sample (checking for 'SICE'):
8 ]5 t$ f& L# n4 R: l$ |( w- A0 R+ Q. |8 p" X+ K* r: J$ w
BOOL IsSoftIce95Loaded()8 Y# K( M  R: l/ n, S/ z! P
{: ?9 F( e  o; I  V
   HANDLE hFile;  : J; [: M8 c) U/ N8 T
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: h  n: }4 n& C5 b/ r
                      FILE_SHARE_READ | FILE_SHARE_WRITE,% I0 V5 l4 l: p
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* A0 [: u- E- l. s/ D! X& A   if( hFile != INVALID_HANDLE_VALUE )% ?8 }  z8 C. Y# i
   {
3 s1 `! j3 v, V, c      CloseHandle(hFile);
2 {; R" D7 Z( A9 z" R      return TRUE;8 z- @% P3 }) A& z- e3 u
   }' ^% X  j6 {  A" V
   return FALSE;% L& _  U1 L9 ^9 `1 Z3 ~
}# q+ _  _- s& X$ m6 p
5 J. N; ~( V1 W( T. ]' B2 `6 P
Although this trick calls the CreateFileA function, don't even expect to be0 ~' T8 d6 o& c! O/ O1 G- A& y+ g
able to intercept it by installing a IFS hook: it will not work, no way!$ Q# b9 a7 ^, w: m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F/ M& O, `- j4 t4 \4 y/ k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
$ [( v  O" V3 r9 n# s& Hand then browse the DDB list until it find the VxD and its DDB_Control_Proc
  ~) H4 p" f* F' V2 Qfield.7 }! M; ?- ^; M( J0 S$ }) ^+ z
In fact, its purpose is not to load/unload VxDs but only to send a & O# G! p6 ?- n1 J8 Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. O& A  d- X! G: |9 D4 h# w/ Qto the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 [( x( O# R% o& Pto load/unload a non-dynamically loadable driver such as SoftICE ;-).
  t2 y1 a( g  Q2 H+ N; ]: Z9 ^/ AIf the VxD is loaded, it will always clear eax and the Carry flag to allow8 f1 ^: l# }3 F. A& q( w
its handle to be opened and then, will be detected.+ f( M0 d9 ]2 N0 G; V
You can check that simply by hooking Winice.exe control proc entry point: j, ~, i4 K( n7 U- Z
while running MeltICE.) ~( B: l4 b, i' l$ A: a
9 V4 `" w' t7 f( r% u5 C) n" q: Q
" B/ Y6 U( o7 {7 k6 x
  00401067:  push      00402025    ; \\.\SICE
* t7 @. d5 A6 o4 [( ?4 f  N  0040106C:  call      CreateFileA
6 H  D- O# g# |8 Y+ D  00401071:  cmp       eax,-001
; q% Q+ O+ A' A3 F0 J  00401074:  je        00401091
2 f, ?, n- o- I( Z0 o9 R4 m
  t! U: a7 ?3 [' ]* X( r+ v2 k, X1 ~7 ~2 N; r
There could be hundreds of BPX you could use to detect this trick.
0 W6 z4 _% n% L6 J7 J* _7 \-The most classical one is:6 J0 Y% H7 l7 ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||" s9 T9 X9 ^0 J+ b+ a
    *(esp-&gt;4+4)=='NTIC'
" a) e) }8 X" Z  w; A7 b1 C7 Q3 r( T, L$ j; Z) }, |
-The most exotic ones (could be very slooooow :-(" l6 {! `2 ~0 s6 X
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( I0 w6 E& X! Q     ;will break 3 times :-(
/ a& H& m% f8 P- B5 l  _9 u7 |  ?+ S( w
) y/ z1 Z: M2 C. R8 n9 B5 T8 W1 ~) X, u1 u-or (a bit) faster: , e& W' I7 z" |5 D) q
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ {9 g) ^* H" ^1 e

* x1 Z5 L& E" y# T   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) x5 |$ D# ~. T, V2 q& N* i     ;will break 3 times :-(
$ I+ b# x, C3 `  j7 E* }3 }& a3 D+ d% k/ V2 A
-Much faster:8 j  X  ^% n3 O5 D$ S* y6 q+ @
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'4 P# s! S- r0 i. {1 f, Z

, h: I1 F' M& w, Y/ LNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
6 z% p" c3 X3 ^, U" ]2 t. Dfunction to do the same job:. t3 O+ u4 R: P# X( n+ h4 K9 s6 S

6 g7 p% X( D0 ^$ ?7 S$ E   push    00                        ; OF_READ& L5 G$ Z$ A+ p$ q
   mov     eax,[00656634]            ; '\\.\SICE',01 [9 Q4 L* k& Y
   push    eax$ ?7 ^8 }; @4 R! G6 g- f* E
   call    KERNEL32!_lopen
( j/ u" H* A# W1 W5 X, ^! `8 d+ `   inc     eax. s; n$ z" H+ U3 |" ^- ^
   jnz     00650589                  ; detected( E, S, }" Z% R% s- `3 s' p' R4 C
   push    00                        ; OF_READ
9 ^* H" o! Z6 W   mov     eax,[00656638]            ; '\\.\SICE'& {+ s; ^& @% W$ V8 D
   push    eax
. s2 H0 F& z$ `& f1 ~   call    KERNEL32!_lopen  a- Z9 j( y, @
   inc     eax: e* d8 y+ E9 A& ]
   jz      006505ae                  ; not detected
4 C1 o/ ^) k) ]8 V: z+ T2 `5 L4 L3 o2 R& K, `
# c6 d# ^5 @2 h9 r. M# M
__________________________________________________________________________
3 R( C4 ^0 A  }+ b2 K  f* i
6 G/ Z- ?$ f# \Method 12
, `* V. C. R9 M8 E8 D( C. b, W1 z4 E=========
- ^% V6 {; t0 c1 N
0 A1 I# c# ~4 q$ ]8 R4 b) TThis trick is similar to int41h/4fh Debugger installation check (code 05
; C( f' Y( U# ^&amp; 06) but very limited because it's only available for Win95/98 (not NT)
9 k$ z" H  T" d! |% @0 kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.4 F; a+ \7 K0 i2 h0 d) O# c% v5 d

! J7 g* q% h6 ], G   push  0000004fh         ; function 4fh- C8 l8 j7 J( p% {) S; @5 s4 i6 [% S
   push  002a002ah         ; high word specifies which VxD (VWIN32)
* h7 e4 I( t( d4 t7 R& Z                           ; low word specifies which service/ Q! l5 m/ u; W. a7 v
                             (VWIN32_Int41Dispatch)/ C3 U3 c7 ]& ?: B5 U5 }& H
   call  Kernel32!ORD_001  ; VxdCall
) f& F- L) f" a2 t   cmp   ax, 0f386h        ; magic number returned by system debuggers
" @3 ]6 a1 f4 T' Y+ s   jz    SoftICE_detected+ h- h  I% g$ p

4 F  m* A% a" d; v# e, b( yHere again, several ways to detect it:
3 X8 K. c8 f! \6 F# W$ u7 }8 B' g8 I$ H( v& Z) ]4 M
    BPINT 41 if ax==4f5 ~8 ]% U: k& A+ L3 v% ?8 h

: ?* `+ Q% n: ~6 ^, \6 x    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; H- w, j; u! {+ s, S
$ ]% k! U' X% k7 W    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- z" l5 ^( {/ A2 `1 N) ?, l; d9 r4 z, W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- P9 p- }$ b! n# U- H8 r% s! q4 [7 o- v* z) x0 J  g* ]# e. `. }0 e
__________________________________________________________________________
3 |3 H  O- R( k3 t/ V( T5 m* z+ j8 \8 X8 k
Method 13* E3 @' c0 c; k$ N+ M' n
=========
$ E; Q& Y5 [2 `7 @8 F( ?1 b7 D. ]8 R% j5 a" v9 ]  J
Not a real method of detection, but a good way to know if SoftICE is3 s" @6 g* T# v/ y" r, N0 w2 [
installed on a computer and to locate its installation directory.3 w; d8 t; o4 V, \, W5 v
It is used by few softs which access the following registry keys (usually #2) :
/ t7 @. l' k1 ^+ n$ o5 o( `# l1 F6 r7 M: d5 {
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ h; C- s+ d* b% _; n' i
\Uninstall\SoftICE2 K% {' O6 C3 T" ?3 y- L0 \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ Y- N0 A3 A- m-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  I  m% p+ S4 G# Q\App Paths\Loader32.Exe
0 ?% Z7 n8 L' V- _% p( n* w6 _4 Z/ m, D% V

' f$ f6 T& I) P* a$ DNote that some nasty apps could then erase all files from SoftICE directory1 P9 p3 W2 T  G( ~8 @
(I faced that once :-(
8 `4 D+ E' @( z$ a: R- u6 ]  Q8 z/ q1 _% J; k
Useful breakpoint to detect it:8 Y/ d; Q$ O1 m0 ~# S& o# Q$ L+ y% c

3 R4 L! {$ U  l     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
* u/ ^; h4 M/ {/ S% [' Q" ^+ Y# [# L" N. @7 y
__________________________________________________________________________
. k1 v7 K2 p+ Q# l
4 v& |5 S: M! q8 H1 D) B
5 |; X: l' \/ W7 YMethod 14
, c$ G" A/ x$ l* }) C7 L) s=========
' k4 ^9 l* y. N3 R" m4 N
2 f1 C: K2 A8 R) x, UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* k, W. }; d" [, I
is to determines whether a debugger is running on your system (ring0 only).
% S4 K7 i9 Z& u+ w2 `: [9 a. W$ D1 g7 T9 }0 L6 m
   VMMCall Test_Debug_Installed
( G7 ]# o1 {9 x% V; y9 L   je      not_installed
: p8 d# x2 Z) k
! q0 C; W- Y# `  UThis service just checks a flag.
; Z0 o( s: T& h, P6 |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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