About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' `1 `0 E7 l- g4 l# f6 m
<TBODY>5 y% K6 t1 q* W# Z9 G: `
<TR>
9 A6 [. ^  h' V( ~9 m0 }<TD><PRE>Method 01 4 ?" K# H7 h- I, M) B( y- f" c
=========( ?4 _2 K$ o0 C2 y4 J" r0 \
% s! S8 S& c1 b4 T. f$ a$ ~- I
This method of detection of SoftICE (as well as the following one) is6 b$ `' r' ]" j1 g6 @0 A
used by the majority of packers/encryptors found on Internet.5 U) L) o) Y7 P1 T1 i+ D3 q
It seeks the signature of BoundsChecker in SoftICE9 P( E3 L* e# y% }

9 {* q6 ^; i3 N: F/ k    mov     ebp, 04243484Bh        ; 'BCHK'  ~# J/ ^3 B. t! j: R0 ^; D' {
    mov     ax, 04h0 `2 {% j. V6 W; h! w1 O( V
    int     3      
/ y" m2 E; U5 w2 E* w( _7 d* o    cmp     al,4# C7 a5 _' ~8 g, {: M* o: L) d
    jnz     SoftICE_Detected4 C- `( d) ~, `4 D) u8 t
4 y7 b4 g, m. [
___________________________________________________________________________
: D8 o! r3 i: |+ ?, g
: v5 w: O) e) @* M/ aMethod 027 N' C+ y$ W" p% Z, \4 K! v) o
=========
2 G! H; V% K9 ^7 ~' ]
5 B+ I& h8 Q3 I; AStill a method very much used (perhaps the most frequent one).  It is used
' K* F8 f- ?: d0 ^7 hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: W0 t& E. Z3 i1 V. eor execute SoftICE commands...
  _' x; Q4 r& w2 T* T1 m: w1 _It is also used to crash SoftICE and to force it to execute any commands* s9 J3 k& l/ {# [) V* W
(HBOOT...) :-((  % \; n; j* m! F- m

% _" D3 S. b/ F! Y- z5 {Here is a quick description:
2 i/ @% J. \& m+ f, t8 p8 ~/ ]-AX = 0910h   (Display string in SIce windows)
) Y3 ?( R! U! i, \, `1 R-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 V" H' x, N4 l. H' s( Y% ~/ ?$ \
-AX = 0912h   (Get breakpoint infos)
' f9 h$ c% i! Q* p% ^-AX = 0913h   (Set Sice breakpoints)
: Z6 R6 ?5 m9 ?* W4 P4 D, r' K-AX = 0914h   (Remove SIce breakoints)
) C5 _% N: c, \
2 w7 w. _+ W5 n- v4 X9 p' ?Each time you'll meet this trick, you'll see:
/ Y5 ?, l2 r' @8 f- b8 Y-SI = 4647h
% ]" g% ?: @- |7 x-DI = 4A4Dh4 S1 C. |- E. O: h1 x( B5 d6 b
Which are the 'magic values' used by SoftIce.) l1 O* z! N- W: v( \5 P' I- E
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! d' S' u# w' ^. y4 ~6 H( `* ~3 ?5 a& v
Here is one example from the file "Haspinst.exe" which is the dongle HASP7 }, i' g( b  U. @' h+ D0 r$ L+ m! a
Envelope utility use to protect DOS applications:
8 u0 f, _7 a, k  T( T; }5 I# N' L6 G& \, Z" e
3 L" b+ [* X5 E8 g5 a
4C19:0095   MOV    AX,0911  ; execute command.1 x# @" X8 x" V' z7 D5 K0 Z# _
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: s! N8 ], z. _. z
4C19:009A   MOV    SI,4647  ; 1st magic value.
( K, ]  h6 b+ w4 ^4C19:009D   MOV    DI,4A4D  ; 2nd magic value.4 w! G- t$ U0 j" x7 G
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)( r. L  j& O4 l* ^7 ]  w
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute* `. e' u8 G5 ^
4C19:00A4   INC    CX$ g9 S, R! N' P7 q$ S9 j0 ]: J
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 K: h) B* _! U) [4C19:00A8   JB     0095     ; 6 different commands.
% _6 @# j" K' g' m( k4 z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ ^, L1 L1 _+ e4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
+ _1 ]% g) t/ E  A. S
( s: _( f! z( ]  V$ T  F+ ~: k+ z) {The program will execute 6 different SIce commands located at ds:dx, which6 y6 i. _+ j( M+ \
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- Y; V6 w+ w7 z1 t( }# V! L
! q) \) A  v! Z/ F
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
0 |3 |! A* T- t7 d7 O___________________________________________________________________________" D; I+ L) L% ^

1 R8 O; E5 J$ c/ v# @
/ `8 v& B* v: ~6 a, QMethod 03
6 N, Z1 |  ?9 }- w" S4 E=========. \' f; p2 ?; G' @+ p

7 d" Y7 M$ x8 n4 C7 F* P# |1 mLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ T: f; b5 j: Y* N7 }' B1 k: [
(API Get entry point)9 r: g, p, |- E! ~0 z6 z# w
        . o( K5 S1 d3 g9 i
/ `# f1 |" P- S2 n0 x9 S
    xor     di,di) F6 o' [) i$ p# l8 I# O
    mov     es,di9 E: A& u  ?( Z$ @  S4 Y( w" y: R
    mov     ax, 1684h       / w5 P+ P7 a! p) t  g6 U0 a
    mov     bx, 0202h       ; VxD ID of winice; q$ F: t1 w( s/ }% X8 t
    int     2Fh8 ]4 H' C, Q  T& h+ C. j
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: L, j5 M* o) R6 X    add     ax, di
+ m7 H2 y) Z8 m& Z4 q    test    ax,ax$ ]3 ?' f3 s6 D
    jnz     SoftICE_Detected
% I; @' p* `3 }; F3 x& f" N$ \2 Q6 o  g
___________________________________________________________________________
2 G$ H+ z# S) {: I% i3 W' Y/ n2 ]
" m% j, V$ `. c. U) y9 V, HMethod 04
3 _9 j* \; P7 Q9 c=========
2 i" |5 Z$ W" x' Q
2 t0 G  n4 Q8 }8 g0 B7 [Method identical to the preceding one except that it seeks the ID of SoftICE3 I0 F/ F4 C6 J6 S$ R
GFX VxD.( w. X, `  l5 [$ T. @! i+ D3 H6 V
' b& h4 h# ^0 ], B2 U2 L
    xor     di,di
1 w9 j( \; z& |- j0 [& B8 [4 O    mov     es,di
7 ^2 [, Z" n' N( t6 o4 A    mov     ax, 1684h      
5 l" P; n7 ^7 _; q    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* s  _5 B, J/ s* |    int     2fh
8 V8 i8 [" v! n% ]( a) f2 r    mov     ax, es          ; ES:DI -&gt; VxD API entry point( N: V9 W: Y$ Z/ s- ]" [/ Z
    add     ax, di: V% S6 f  d: U8 M# n6 t
    test    ax,ax
  R% k& X# K8 E# o, o" F    jnz     SoftICE_Detected
$ L/ j' ^& a( P! ~8 ~/ p2 |& Q" m) O' \6 x5 x& @
__________________________________________________________________________
& p$ u- o, H5 F  H* N/ I! O( s9 _+ g
5 h, z1 H0 O8 l/ y; u- a5 \9 @9 j# P6 d# r: {
Method 05
8 G& r1 {8 h: \8 ?+ X7 Y/ i=========' I' q( S8 j& ?; m0 g8 d; h' \

. X- Y2 @9 s9 x2 w) MMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 e7 Q, ~" a& A! I1 qdebugger. It calls the int 41h, function 4Fh.. ]' P. e0 ?1 s+ }( V+ y( i6 k
There are several alternatives.  3 m) L+ _5 d, P% w! {

( A  J6 x' \5 K, hThe following one is the simplest:. F* D; M  V" s1 T) c+ `, m
$ O: j( D" d& ?3 j
    mov     ax,4fh
: e9 s4 A) T' Z8 G9 c! z    int     41h  X: S2 v4 v. M: Y
    cmp     ax, 0F386
' l1 I  i: a# C  C- b+ H. ~3 r    jz      SoftICE_detected+ a: Q# x) o( u3 r& r) T* }  |, d

4 v  ^  W. H- s5 ~  B3 z9 a4 K1 e1 N- \5 x
Next method as well as the following one are 2 examples from Stone's 2 H' c4 d, Z: T, i- }  a
"stn-wid.zip" (www.cracking.net):) R( ?" P0 n1 U7 q! A( Q
- p1 V3 a- t& _7 E& ?" ^* |
    mov     bx, cs) I+ k" Y. E0 O# \8 T; Z* `) _5 a
    lea     dx, int41handler28 G& p" Q1 i9 A1 ~* z
    xchg    dx, es:[41h*4]7 S* d" B6 b$ F) j0 L& H' [
    xchg    bx, es:[41h*4+2]
# y! K0 P( M. s& ^    mov     ax,4fh
9 }8 X! ?: A. l# R! i% C    int     41h
4 [; p  {) s- ~  f& K    xchg    dx, es:[41h*4]! A/ b0 X+ N. e2 ^8 |/ ]4 {& `
    xchg    bx, es:[41h*4+2]
; q$ D& e7 U2 q- V4 a    cmp     ax, 0f386h0 C6 q( h, p& r5 Z" Z) {
    jz      SoftICE_detected
5 J( l6 [5 e  C
( G) \! L2 J0 g# Uint41handler2 PROC( x4 C" l  E# s& P4 f
    iret
( N/ T1 u* d! K1 c/ p- T3 Q0 D" wint41handler2 ENDP
0 Z2 f* b; k7 B
$ t, a2 c2 y7 O/ s! y
7 G( L, Q+ a: x; A7 X: ~+ D6 g_________________________________________________________________________
3 T1 S& X- Q- y4 Z/ U1 M: Q
9 h  [9 A5 i9 ?4 u' i' s
0 _9 t  K; y/ ~$ I9 H* u; h. Z& mMethod 063 O1 T8 b3 u" j3 G$ [# P
=========
% m  ^* ]  a0 x6 F- P$ m+ D% U7 G7 z/ R$ N; N! \

/ y4 B, I- v; V/ N2nd method similar to the preceding one but more difficult to detect:
$ m! b" |4 }4 p
7 y& x8 |. N9 T# e. h/ B/ p$ t. p
$ e, v0 b, ?; T5 Q/ v6 Hint41handler PROC
, M$ r) c  K3 j0 ]# q    mov     cl,al
6 l2 I  x' S$ j9 }7 k7 G    iret! w) B% Y1 u# k1 l
int41handler ENDP
& G* Q7 L7 y% i" `7 d# W+ {& c5 @6 {

, d4 b' s5 t* C! K- v& v    xor     ax,ax
- s% p; ~, ~, j( `  P2 {0 O  t    mov     es,ax
! V( c% y9 Q- @( ^4 v0 [9 w    mov     bx, cs
$ [- a; P& Y7 m" R    lea     dx, int41handler
8 ~  O' y: k: M/ D% B, j; h    xchg    dx, es:[41h*4]) d/ i* I# i7 h% w
    xchg    bx, es:[41h*4+2]
  r6 M7 Q1 E% ^( |$ c0 y1 N    in      al, 40h) ~! ?: w+ V+ D
    xor     cx,cx
% J; p5 i$ @- f5 Z; c5 p9 R    int     41h
$ o2 L0 \2 ^5 R1 p; G    xchg    dx, es:[41h*4]
6 p7 A/ x) E) D2 F, N    xchg    bx, es:[41h*4+2]& ]4 O; I& D+ e: u# h0 r1 @
    cmp     cl,al
8 Z) E9 i$ J& b& E% H) \    jnz     SoftICE_detected
1 f5 I7 |$ E5 [* w9 R
' w' \# j( r' [_________________________________________________________________________
5 z* h0 q+ t0 {% Z2 i3 @2 k
, Z- O5 r$ D8 S4 N' fMethod 07
$ N+ \' |$ i8 R+ [3 K8 z) J; ?=========
4 \" l" H2 B' K- i2 I: P/ v
, a/ M0 e" N% [! ZMethod of detection of the WinICE handler in the int68h (V86)
& Q# l4 ^) e0 z7 E
( x; t( P( u( Z3 B; Q    mov     ah,43h/ p5 v4 f/ s8 i; Y- Q: o
    int     68h
3 K: Q* H4 j" g    cmp     ax,0F386h
$ [4 u/ I  P3 O    jz      SoftICE_Detected. `3 |& x$ ~: y# S/ m
! b" X7 h# C2 C

( C: b* I! n2 V. W7 B9 _6 z) q6 X=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# U/ j  B) `: k7 e7 ~/ v
   app like this:4 f+ x0 K6 S: s( ~

- Y0 A2 D4 ]% y   BPX exec_int if ax==68
, q% y4 O/ W/ U0 u( \& f+ n  ?   (function called is located at byte ptr [ebp+1Dh] and client eip is
) g. u& G# {+ @. z( X, u  H% K   located at [ebp+48h] for 32Bit apps)& I* u; w% t6 s0 l" U0 R
__________________________________________________________________________
* f2 ^. ?0 {1 ?5 Z- B. g' O  l8 d+ g9 \' `; W+ w
; c4 \5 m  Q* D9 z1 v9 `2 T
Method 084 `& }( K! ]- g& |  n
=========
4 F7 G6 l! y5 q% F/ S# f
" T1 p5 A+ s6 c3 S+ x: d  BIt is not a method of detection of SoftICE but a possibility to crash the
) t) H/ ?5 k, Wsystem by intercepting int 01h and int 03h and redirecting them to another8 ^" A9 v) Q: V0 H1 Y
routine.6 |) I8 A+ u3 Y* C* Y8 s3 A
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
& }6 D4 n  g$ e0 [( r% pto the new routine to execute (hangs computer...)5 ^9 n( @$ t2 G* J! N; @- L$ y

: L; V) i; j+ n; G    mov     ah, 25h8 m1 e' |+ F" q( v3 h2 S
    mov     al, Int_Number (01h or 03h)
; L& \% U/ ~  j    mov     dx, offset New_Int_Routine
( K. {( y$ {8 h. G! v    int     21h
9 Q$ j6 u1 Q  E& E! ]) h- K  t
& Z+ ~: B0 J- |__________________________________________________________________________
  C6 c( t) a9 t8 r( a  S6 `. j( Q5 @% `0 i% L& P
Method 09
6 T+ V; p* w) C# n3 I0 C0 j=========& ]: O& n2 Z% M+ [/ k4 G, U* D

; z8 G6 q# {. I$ aThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 l% _/ S, K7 Rperformed in ring0 (VxD or a ring3 app using the VxdCall).
, b% F$ O" Y# P5 p( Q4 o! mThe Get_DDB service is used to determine whether or not a VxD is installed
  Y, s' d! s6 z3 D& c; B! c% K! Z, zfor the specified device and returns a Device Description Block (in ecx) for' \% N0 a# L4 O8 H. G' _* O2 S
that device if it is installed.
0 k: x4 b$ Y7 K7 R* y# y& e4 j. B  y. x  |
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 b! Z2 Z; Y7 l7 q4 b
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 y0 g1 W8 z  y9 [% C* f+ Y# M
   VMMCall Get_DDB
' j( j7 {' b2 O5 `8 `4 ~$ C6 _   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: X. q+ g, X" _9 E; {; g( \2 R

% o6 l( w6 Y9 k- D2 [( ]Note as well that you can easily detect this method with SoftICE:
4 w) l6 g4 X2 G* e% y   bpx Get_DDB if ax==0202 || ax==7a5fh
! E" |* t, S! w. O' n- j4 Y
2 i- I( A3 O; W" I; @  q__________________________________________________________________________
- u6 s+ a3 \3 o; D. z" k/ c7 w: X
Method 10
3 ~$ ]# r1 M% {$ ~+ {) {3 N=========
9 q% M) U; h6 ?9 g# }$ n. b# s3 I2 L' D- m+ E' D
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: i7 I) C! N& p* Y. k6 h7 H0 C
  SoftICE while the option is enable!!
+ M6 n3 E( T. K+ _9 X2 k. a
3 F4 W: O& Y# z' J1 h' H3 MThis trick is very efficient:
; F7 ~5 ~# k4 z2 A0 lby checking the Debug Registers, you can detect if SoftICE is loaded
' _( A2 r( q4 j0 @9 L(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* W7 ]9 G, w7 g7 }! Tthere are some memory breakpoints set (dr0 to dr3) simply by reading their
) B# g5 d# b  m( Y* P" m. c4 Wvalue (in ring0 only). Values can be manipulated and or changed as well: W  ?  t% `9 M9 P
(clearing BPMs for instance)+ r1 J5 _9 \5 F7 N! i

, o. X; l( o4 X; u/ q__________________________________________________________________________
2 L% s7 ^% d$ p6 P) I7 Q' j
2 z- ^2 Z4 }, o! O2 TMethod 11
* g: O! C3 f  G=========2 B0 q+ Q9 E: L" D; A" v* F
8 n8 V4 S( j- t8 @+ ^
This method is most known as 'MeltICE' because it has been freely distributed
- G4 x8 W. t- K; Jvia www.winfiles.com. However it was first used by NuMega people to allow6 ^" g( ]1 m1 q% z4 b1 [' L7 S
Symbol Loader to check if SoftICE was active or not (the code is located! D# k3 I' @2 s: l
inside nmtrans.dll).( o) T+ ?" \  w( n8 ~# g* o9 s

& H9 r  O. q8 k" g( H; u6 g2 p; EThe way it works is very simple:
8 ~" f* B5 ]8 x* N7 yIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 F2 H; {) z" R
WinNT) with the CreateFileA API.- d. {" n3 [% a- G% r' d* e7 Q

) N" l# M7 r" E" |2 \$ g1 h3 ^Here is a sample (checking for 'SICE'):) E" Z2 N$ O; e1 _" W9 a- _
( z8 `7 e) m0 R
BOOL IsSoftIce95Loaded(), P, b( A5 l: [& J9 |4 R- n: L
{3 g9 a0 [3 P' U8 E
   HANDLE hFile;  , n9 Y/ y: I8 i
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 I! _& w$ {/ B3 O& `, T% g" l# @
                      FILE_SHARE_READ | FILE_SHARE_WRITE,& p+ S- t) _/ [2 t$ Q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 N0 Y  s; s0 [8 w   if( hFile != INVALID_HANDLE_VALUE )
5 {: A  h, j5 @+ Z, ^   {& I, |. A! l+ b2 H3 r
      CloseHandle(hFile);
  P. f. W2 F' z5 N8 N      return TRUE;
6 P" P% m4 E9 M' a   }6 Z$ v, p' r5 {8 }' y6 \
   return FALSE;; b  H& X! F2 V# p) R8 i$ D
}9 @% Y7 d7 Z7 B* A
% d* P3 ~) `1 g/ a1 G# O  j
Although this trick calls the CreateFileA function, don't even expect to be5 p; E( V5 L. v8 I# t+ O* e, R
able to intercept it by installing a IFS hook: it will not work, no way!6 m+ I; B0 B; U
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, {5 |- T/ v  @1 I8 mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& Y9 M2 R8 I2 c3 o% y* m+ gand then browse the DDB list until it find the VxD and its DDB_Control_Proc
# t6 M7 R# I* U6 o. f3 b3 qfield.0 _. s9 z+ W0 s7 @/ |& H: r
In fact, its purpose is not to load/unload VxDs but only to send a
% V4 I7 o3 V# ZW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 v% s8 T/ l: C9 cto the VxD Control_Dispatch proc (how the hell a shareware soft could try* ~: _( h2 Y& @# P9 v9 v
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# [; |5 U0 \# a& c# C* hIf the VxD is loaded, it will always clear eax and the Carry flag to allow- P4 H& Z; J- Z5 |
its handle to be opened and then, will be detected." S( e3 b# n% q. H7 g1 T  H8 i# b
You can check that simply by hooking Winice.exe control proc entry point. \$ w( v" z7 Z  ?7 H& |  b
while running MeltICE.
% Z) ^; Q' f+ j' d8 Z3 p( f0 h: x) A7 I
* _4 ~. T! G% M3 \, l: g
  00401067:  push      00402025    ; \\.\SICE0 J+ P, x$ O4 e3 e" R5 ]
  0040106C:  call      CreateFileA
/ h) v: Q: H% p$ Q) N) h  00401071:  cmp       eax,-001
, w4 I' u; x* v9 Y6 e* H1 i  00401074:  je        004010919 X, Z8 j& P. w/ I/ e" Q  e3 L

' M" Q% y# b5 I" A- F# U, L; D" i6 b5 M9 C# w, a
There could be hundreds of BPX you could use to detect this trick.7 U6 a& n+ I8 h1 d2 B, l6 j; v
-The most classical one is:7 n, z8 l+ l* ]/ Y9 I* M2 L7 l. F
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
+ i( y1 I9 @) F! f    *(esp-&gt;4+4)=='NTIC'
' s4 w/ O. N; c" I: o& @6 _7 H. W% g$ y7 g
; ~/ q* ^1 P) {8 J/ ]' B+ M-The most exotic ones (could be very slooooow :-(7 y' b4 L: v2 U# Z1 G5 }/ ]8 p
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% `- Z% V2 f0 ]6 c7 P     ;will break 3 times :-(5 h3 @+ k5 J/ E3 u; D' C1 G) j$ j

- u7 M2 G% K, h' I-or (a bit) faster:
2 B/ t: D# `+ Z: \9 b) i   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 s- U' w$ e2 R( ]- W( [6 d! E3 A# e1 d6 c) d
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) S1 w6 c  F# X- B
     ;will break 3 times :-(: Q" j! q8 D% T1 W  k1 D

0 b+ e9 c/ \3 {4 W9 c-Much faster:. F2 {+ v$ y1 K7 N$ m0 d" y& [
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% N* X9 E  {/ g# g. N1 K8 o! u
# x, k1 p: B$ g: l: X) PNote also that some programs (like AZPR3.00) use de old 16-bit _lopen" L' @" C5 e' _2 S+ n, p
function to do the same job:
) h. f# l" w" t4 m# o* [+ k! m9 d6 x& Y* V5 l! k9 a
   push    00                        ; OF_READ! I1 h1 t, _) M
   mov     eax,[00656634]            ; '\\.\SICE',0' N( A/ t$ @' ?' J
   push    eax
' ?/ X' ~3 e) y& C0 \   call    KERNEL32!_lopen
0 ?: P' ?0 y5 v: }  J, W   inc     eax
! g, K' ~1 ^8 g, D5 w$ N   jnz     00650589                  ; detected  @9 {3 ~0 i# g* M+ Z* w" _/ S5 U
   push    00                        ; OF_READ" G. b/ g: x+ k& h! Z
   mov     eax,[00656638]            ; '\\.\SICE'' ]5 m/ d, w2 D
   push    eax
1 @" }3 `3 u' i3 {5 J' n4 G: I- H   call    KERNEL32!_lopen, n1 {7 c9 A3 [# _
   inc     eax
- a6 e  C1 R2 {   jz      006505ae                  ; not detected
, y( T8 A; A' Q" S* v4 ^
7 g; G4 U' a+ y3 K) }" I. V' h& i; s0 P" i* G
__________________________________________________________________________
9 T4 E2 j! K: ~7 o) I9 @) C; ?9 P- v$ \/ @
Method 127 j& e! C% J4 q2 @5 j+ P9 H, F; S% |4 K3 a
=========
) q7 ~5 u5 z* K. v  a9 c0 D
. N8 X1 Q! z' k  B( EThis trick is similar to int41h/4fh Debugger installation check (code 05
8 i, |6 c2 O- d% b' V9 m&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 c) Z7 w$ ]& f- ^( L8 |as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ i' z. G# O) Z' ~: u; a/ W' c2 G8 C/ G; ]" X8 c
   push  0000004fh         ; function 4fh
7 _; M5 G- P7 b3 n7 G. D. I   push  002a002ah         ; high word specifies which VxD (VWIN32)
% k* ^4 L- x- i                           ; low word specifies which service: c+ ^! v$ z# ~0 ~6 v
                             (VWIN32_Int41Dispatch)! w0 {& l+ A% z  `/ I+ I7 O9 T- ~
   call  Kernel32!ORD_001  ; VxdCall
" ^: n3 x5 m8 u; K   cmp   ax, 0f386h        ; magic number returned by system debuggers9 w( M, h& J/ Q3 S7 S' ~8 M8 i
   jz    SoftICE_detected
$ \1 z; T' H5 i$ ]3 C4 }( j  p/ D$ V
1 g( L9 J7 v3 q. B# Y, p, D; S0 jHere again, several ways to detect it:: i- Z3 w$ M' {8 s8 ^  n! H

: g0 E5 C+ n* X  U1 T, W    BPINT 41 if ax==4f
' Z* p  \+ g" s3 e
% l$ @2 H# o/ g( H9 \    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
% m" ?  I% f2 y
# x) I8 s7 A+ Z% h" b; _0 y    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. M) m8 x9 {% }+ I, m
( \2 M: n2 ]; X: A
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
9 C/ H, I3 \' Z0 g1 P" {8 Q8 Q5 |
, ~) H9 ~& ~) Z8 W( u+ Z. V__________________________________________________________________________5 D- U5 [9 h) g  K$ L# C7 {7 U# R

( z: k' _; [! h/ TMethod 135 L( D: y& R' m
=========2 e# \* n4 h% U5 l- h

$ V, I: g! k& M, ~1 `0 ZNot a real method of detection, but a good way to know if SoftICE is% p7 [, X, ]- H
installed on a computer and to locate its installation directory.* n, v7 S2 c4 w. |7 W7 D. ^3 i5 ~" l
It is used by few softs which access the following registry keys (usually #2) :8 c3 M( |7 b% B1 s5 a# @

0 q% y" a% T3 c  Q( z% i-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% p- `6 |  V/ @0 @6 Z  u\Uninstall\SoftICE
7 `/ A6 n; c6 |4 {3 B5 ^" Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, y$ I8 D6 g, g! O6 }* {9 M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 Z& v2 o4 F4 Y# x* Z& Z
\App Paths\Loader32.Exe( S9 e$ l4 z5 C+ s, Y1 C! O
6 h7 n4 t) i0 Q; c7 m

- y) j+ P) F7 Y" K8 @Note that some nasty apps could then erase all files from SoftICE directory
' L3 T. c& f2 Q, L7 M) r(I faced that once :-(
2 j$ e% N$ J/ ~0 I* S% T( a" L% X% ]* J0 t5 G- X
Useful breakpoint to detect it:
7 ~0 g& r' g3 G; O  w+ D7 A; F
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' |# {4 L' |5 c# N. S
: k* K6 O1 Y% h5 G0 x% F__________________________________________________________________________
( k* \1 v6 p/ F* p9 ]. i; z8 I& i, f0 c! x1 a
$ D  g/ l6 x, u9 F% `) a3 e
Method 14
/ d2 a# P( u8 G=========8 I! O4 v3 c$ F2 b0 U: }
3 `3 N6 O5 \  a8 ]# c8 j, N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* v$ @3 s% [4 y2 E3 B! ?- ais to determines whether a debugger is running on your system (ring0 only).
1 U# n' ?& F5 v+ K8 s8 v" w( M& ~% X& V. ?& b/ l. M, J, F- {4 X
   VMMCall Test_Debug_Installed
8 a! y  H# o) m5 ?0 n   je      not_installed
* n! F6 ^6 I: s1 Y4 }& F2 y7 Q0 P. o$ `. N# B
This service just checks a flag.
& O! j7 B& E! b0 ~4 b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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