About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; U8 u$ \9 O. |( A8 q, ~( y  x<TBODY>
) f2 b) j* T9 M, u9 q$ a$ s$ q<TR>
; j9 h5 _- d: G: v8 u. N<TD><PRE>Method 01
' A6 K) t; x! E- I- t=========5 u9 e0 w/ W/ k

6 h7 e/ ~5 |, l" H1 dThis method of detection of SoftICE (as well as the following one) is1 l' C1 s! A6 d7 u) d( v2 x
used by the majority of packers/encryptors found on Internet.) i$ o8 O: ]0 l1 j9 z( \4 @9 |0 Y# p
It seeks the signature of BoundsChecker in SoftICE
: o+ a" l2 `. T2 i) r1 e5 p- ]% X' |* N2 _1 v8 y/ @9 Q
    mov     ebp, 04243484Bh        ; 'BCHK'4 v- A, T" E; e" k0 d8 C
    mov     ax, 04h
4 `* H/ t% ^5 X# V, S    int     3       $ Q8 ^6 y1 r% f
    cmp     al,4
- ~1 H* r/ x4 `! j9 \" G    jnz     SoftICE_Detected
6 _0 o8 {) j) b' H4 B% p% o! c" y; K% ~: A, M
___________________________________________________________________________) ^7 ?- x0 X" X! U, }' {1 ~

( S( w  A$ p/ p' u9 g$ v1 M4 ^3 {Method 02) a+ t/ x" r6 F# \& I! Q
=========0 S* _. ^) S% }
' a4 [4 u# {& l3 ^/ Y
Still a method very much used (perhaps the most frequent one).  It is used
2 S, k) X" i  H, Vto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 g' ~0 Y2 I3 O8 g. sor execute SoftICE commands...
0 S0 k: ~" b7 `, ~$ NIt is also used to crash SoftICE and to force it to execute any commands+ [0 s$ a2 [( @( v
(HBOOT...) :-((  
% P& n2 F, _# }* J
; B" @  E9 g0 K6 CHere is a quick description:" Z% P% }. C. _
-AX = 0910h   (Display string in SIce windows)! n; @9 o& F  X" X! S: O1 u
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! \  P# K* T# S. _- @-AX = 0912h   (Get breakpoint infos)
# t( X- S2 s: g-AX = 0913h   (Set Sice breakpoints)" u6 ]# V3 P6 P) U; ~7 g
-AX = 0914h   (Remove SIce breakoints)
$ i, g; F+ X' d  U% [. S$ S* p/ [
  _! a9 s" _! x9 xEach time you'll meet this trick, you'll see:5 f! b2 \* d" c! D
-SI = 4647h0 O2 V8 a( k+ P, X
-DI = 4A4Dh
7 J: ]+ p! h# x! NWhich are the 'magic values' used by SoftIce.
( z+ z. @$ J* a0 i. LFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.5 \5 V8 i/ F3 t6 j+ o

: A6 @4 W8 E6 |" Z1 w1 U' ?0 A# LHere is one example from the file "Haspinst.exe" which is the dongle HASP
. e9 t6 M4 \' HEnvelope utility use to protect DOS applications:
) W- ^8 d0 l( B- o* [- f
' }+ ?6 ]! q$ c, Y7 x/ o: R# f3 O" e; K6 B
4C19:0095   MOV    AX,0911  ; execute command.# O5 @) S1 ]. e9 c1 W0 L
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).( I5 y$ c+ ~! S1 W! _
4C19:009A   MOV    SI,4647  ; 1st magic value.; \1 t8 E+ y( Z
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.$ \7 T8 ?& U: @! T* ?* ~, ~
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)' i# n& z- z; K8 J8 f! ?& W
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& r/ }2 b& S! f! r" g. n7 v4C19:00A4   INC    CX* V4 Q* {6 Q, U3 _6 C" h, v9 i2 F
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 V% U+ e- l2 \# Z$ z. N5 M! B
4C19:00A8   JB     0095     ; 6 different commands.) a' q# w" g6 |; Z% s. q, u
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% @2 g* D. q! c* ^( K: R  p
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# y. `9 E" ^& v# o9 w9 E4 a# q8 o
1 v& n0 m5 [& [7 A2 k; \The program will execute 6 different SIce commands located at ds:dx, which2 @7 Y2 M/ o5 _8 K6 o0 A) N3 Q2 j
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) x( B! d7 h  u: F
' [6 G8 T( f0 S+ _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, O; ?! t  d5 z___________________________________________________________________________. K$ z' f' _+ b" O
  q' O; n/ M# @+ d$ S

+ }. f( ]0 g9 QMethod 03
4 I& F" f# R: b( j0 t$ ?5 c=========
; {7 h3 m, K+ C1 f6 u* V$ ?, x% n8 ]6 R5 q+ |
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
% ]4 J& H3 Y9 x7 ?2 o(API Get entry point)0 G8 W, t# X) j8 t6 u: z" C' ]; d
        
- t7 W( |' `4 K4 {0 x
. {5 Z5 q5 o& h# ~& H& W    xor     di,di9 {$ P' F" P. s! j- H
    mov     es,di: H% A$ m4 ~9 W, A1 G) ~
    mov     ax, 1684h         a$ \& l- l4 t$ E5 x: [$ G0 C6 `
    mov     bx, 0202h       ; VxD ID of winice' O/ J) ?$ _6 v* x2 W: z
    int     2Fh
: H3 Z- a3 e5 z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: {' K- ~" v! x* H5 {& n    add     ax, di
: y; B4 r+ I+ ^5 s' Q( W, L- }% x$ n0 R" [    test    ax,ax/ ?' |2 `$ |2 T9 o
    jnz     SoftICE_Detected8 Q; o) K( S7 q9 P: K8 W+ |
8 [" M( a$ q& e/ u
___________________________________________________________________________
' R5 Z' l/ l: Q& j% p) ]: S1 k$ d( O" T, N# S7 M
Method 04
7 G8 ?) _( u- @; j9 f2 e% s; R=========8 m, X% I$ r. J/ a

$ N  @+ w2 X: s+ s. P! tMethod identical to the preceding one except that it seeks the ID of SoftICE
3 o$ @' y2 e, K" ]  c$ W5 pGFX VxD.2 L7 v, }6 h1 D9 Z( w2 [
% R2 \! I4 H6 V) R
    xor     di,di& }% r/ e4 y2 M! x# o( V
    mov     es,di
9 U& B8 r$ a" ^3 P- I# @" {0 v/ m    mov     ax, 1684h       4 B+ J8 H5 P( ]# g& J/ h. u
    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ F: \6 |9 I0 I. u8 }. i. U! a7 x
    int     2fh
6 @% Y( e$ k7 X: o: t; {    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ ^! z+ r! a5 v4 ]- u4 i
    add     ax, di3 x+ R5 ^; F8 p! P2 [
    test    ax,ax3 e, D; W: s' H+ I* p
    jnz     SoftICE_Detected
) z4 Q! B1 O! e/ J/ ]; n" r9 `1 E7 [& e5 P# _+ x. ]+ b
__________________________________________________________________________: F( Q+ X4 C5 h; i2 `6 o  \
  C7 g1 E# X& q0 q1 k
% X, ]. N- I$ M  m
Method 050 N  U/ B$ M, e; ?8 U5 c; n4 R+ O0 c
=========
! z7 E% Q5 s; E; S$ Y* d9 \6 N2 M: @( g3 J
Method seeking the 'magic number' 0F386h returned (in ax) by all system' B; g# Y$ `# r2 Y
debugger. It calls the int 41h, function 4Fh.. Z  T9 H  e' M
There are several alternatives.  
8 c5 n0 P' Q! r8 ~8 m1 W5 b
/ p* q. m4 Z7 g$ g5 KThe following one is the simplest:
9 B& }9 J" G4 \' Q9 @; \: Y/ [0 I
6 \+ ~8 ~; n6 e( {. Z9 ^* [    mov     ax,4fh3 O# ^+ V6 T: c. n2 x
    int     41h% u& Z, i' B6 n/ V4 M- I
    cmp     ax, 0F386
# [! U1 ?8 m1 h0 O% a  m    jz      SoftICE_detected% ]8 M! ~% D$ Q

' ^9 z& g* ]9 {$ u" {# \
+ h9 B6 I/ Z; k6 S! G$ aNext method as well as the following one are 2 examples from Stone's * \. B0 E; U! f; c6 ^1 p3 r1 {
"stn-wid.zip" (www.cracking.net):- n5 G) M- Y+ G" Z; M  Z/ z
/ M' {. D/ V9 i  X& I, ?' H6 L
    mov     bx, cs2 V- o5 t4 w" r. Z, U% S
    lea     dx, int41handler24 `5 [0 w0 R! h
    xchg    dx, es:[41h*4]
) H- e! u! Q, X0 G1 U& O    xchg    bx, es:[41h*4+2]# T+ T7 E. {! q! n7 V
    mov     ax,4fh6 g. q5 U: E; V/ j, [! V4 P+ ]; T
    int     41h$ v8 A& Z! ?8 J( C4 f9 ]) E9 A3 H
    xchg    dx, es:[41h*4]
' D+ e* W( ^6 h5 n; P5 c    xchg    bx, es:[41h*4+2]
) L( T  W7 H( X& ~1 @  Z    cmp     ax, 0f386h. m7 X8 `' ~" z: a
    jz      SoftICE_detected: K3 w1 c' [, F- r4 A2 b: t6 y. F
. ?9 Z  B# y5 V8 a# a% x
int41handler2 PROC
6 m3 z9 W- r" I' A* v2 `    iret
9 ~8 N% E, `7 C7 g* t3 X' D6 Z  Y; ]int41handler2 ENDP
5 w/ q: U+ Y# {9 b
9 B9 K# n: d  F1 V& Z# N; \& S& L
. M+ H8 d9 D4 k. G* t_________________________________________________________________________
  h, @: O% r: x7 |! M; y+ u9 ]0 B8 a8 A# t0 O; {/ l
# \( u; O% W( Q* C$ L- y, l0 Z
Method 06
. l* q2 i, U9 y9 m1 P/ y3 k3 O4 n% x=========
; m* m3 P6 h7 v) u) I5 n; V
+ h' L, c! R% Y2 A% L+ H
! j8 E% H7 }! o2nd method similar to the preceding one but more difficult to detect:
, j0 @" _9 U# l- a+ Q/ ^% g' a! \: V2 s) l* N

# @3 j/ N& x0 J. x1 Eint41handler PROC# s; G) h. i& J, [& u$ [2 y7 J- \$ x' h
    mov     cl,al5 F7 y) e" H( X+ O, C$ L% `
    iret2 x3 K% }) ~* g; ]6 n( r' v# ?
int41handler ENDP
4 O1 Q% {7 e. o1 d7 a# b7 m5 V& I( x" K

9 Z+ a# R9 [) F7 |8 b1 F    xor     ax,ax
! I* p4 \) n1 y" Z. I+ X9 a( N    mov     es,ax
1 @: m0 t) r% q5 a- w    mov     bx, cs
6 G& w0 P0 R9 ~( V% p. Y    lea     dx, int41handler
+ ~1 @# x' @- |" N- g5 Y, ~    xchg    dx, es:[41h*4]
3 u8 p6 l4 J' v4 x# N    xchg    bx, es:[41h*4+2]
% Y. x+ y- a: ?, v' W. r    in      al, 40h
% x! ]) d& H1 `$ L    xor     cx,cx/ x7 P0 ^! n- i4 d
    int     41h; t2 G2 U. R! j6 u4 C3 X6 |
    xchg    dx, es:[41h*4]7 r' L( @; ^7 t0 w% H- R0 I  E
    xchg    bx, es:[41h*4+2]
; o) V8 P- v' d    cmp     cl,al1 N  ]1 J% O; X
    jnz     SoftICE_detected' n) X4 c0 ^' H

% }: d0 @& w# z' o) _' u  I0 N/ G_________________________________________________________________________6 d% y. F& q) ^+ P2 _+ A2 M

$ z0 _+ S% Q. x  c7 E& JMethod 07
# _. n/ B7 L: m: K! ]=========
* W8 d2 S; r2 N7 f( k& u+ `
- h# z1 g: C& U( s. w+ JMethod of detection of the WinICE handler in the int68h (V86)
. T: O9 c; C9 G
2 @/ ~, q- V& H5 b: M    mov     ah,43h
/ K; d  L! l6 l8 L2 ~' n2 V    int     68h& b* z9 p( S7 H+ q
    cmp     ax,0F386h
' ?1 l3 v. `9 D+ x1 x# e& }    jz      SoftICE_Detected+ V. U1 T- c) h0 z. U7 C

5 g" H- I. A0 x, i
9 g$ u9 `$ a% M/ X6 J. T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit4 @! S( w% ?; n- J" W
   app like this:
# e, y& r$ D2 N/ s% m' ^
8 r& U  {& ?* s( r1 Z3 M   BPX exec_int if ax==68' D3 _/ G$ I5 r, j9 F9 k
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# K; h/ v1 {8 }$ J- t9 i   located at [ebp+48h] for 32Bit apps)3 Q* \' T. Z8 |' D
__________________________________________________________________________
! g& V8 u7 J" @! M0 c- w! a7 q' c3 j, W) `4 x
+ |- t5 ]" y9 D9 Y/ ^/ `' G
Method 08
6 k; E- j, l- d9 e; [: r=========% B0 j3 P0 k( E) ?# ?1 i: v

2 `( V: K9 o' b6 \1 hIt is not a method of detection of SoftICE but a possibility to crash the" c+ j; D% Q/ Q9 N+ J# V
system by intercepting int 01h and int 03h and redirecting them to another- k* L4 Q, U4 }& {, v9 y( [
routine.! V. t6 P* i* J0 |! s2 L
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points! F0 B- _* [8 S5 }3 P) _
to the new routine to execute (hangs computer...)7 q9 L( O9 ^0 d% @6 r

* k% X0 O/ i% H; C    mov     ah, 25h
- m+ k  z9 p# W3 |* P; m( A2 S2 f& h    mov     al, Int_Number (01h or 03h)* G/ C# u+ j7 A$ r0 U5 d3 S, K
    mov     dx, offset New_Int_Routine' Z6 b" `; l) n3 k2 J
    int     21h* N4 x. U1 U$ J% Z5 ?

8 g. [. m5 T  {2 u4 K. F  Y__________________________________________________________________________
  L  U3 W0 P2 d  \4 S! g
' g+ M1 ^$ K  ]* J: T% |Method 09
$ \- S( S9 u) L: w% h, e=========  h: Q1 j: i- L+ N+ }; X2 M! V! T
8 V. }4 n  Q+ ~
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' s) `- x5 j" E5 r, Y
performed in ring0 (VxD or a ring3 app using the VxdCall).
- m$ E$ o6 C0 G: [The Get_DDB service is used to determine whether or not a VxD is installed+ g; ?: ]! _% F* ?6 O1 t" t) [+ Q
for the specified device and returns a Device Description Block (in ecx) for2 u. {5 c4 n- B0 C$ K/ {
that device if it is installed.: T' H* e, I3 D9 _" F
7 J0 ?% P+ f% z# v
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: S1 ^3 k- w( u* a$ L+ @6 u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)  D) C; J' K% X, [3 C( _- C, \
   VMMCall Get_DDB
8 a. P9 |6 O2 k3 o1 F/ j, O" t   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! e! o6 J4 j5 ]( K

- A& }, k- F7 Z1 G% fNote as well that you can easily detect this method with SoftICE:  r- r: B9 ]9 _# [6 e* s: ?
   bpx Get_DDB if ax==0202 || ax==7a5fh0 H# g9 w9 s. C
+ P( N- u* N/ G7 A' E/ f, V
__________________________________________________________________________* w! k( n$ W$ g9 E/ {

4 h" y9 J3 B" R8 o4 hMethod 10* o$ B' c; m" e
=========# I' `% q' W6 f4 O4 v3 T/ m
* X9 A2 m8 n& {3 t4 m* ?: A6 ?
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' q# I  M: ]: [1 a  SoftICE while the option is enable!!1 Y2 n1 {5 n# f5 I6 T

! r3 ~5 C; |1 N: f* cThis trick is very efficient:1 ~+ `7 x) z/ I) y9 h
by checking the Debug Registers, you can detect if SoftICE is loaded" X( n% `  T) ~# ^. [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
3 V- ^9 G% e  G8 C# l3 l) ]there are some memory breakpoints set (dr0 to dr3) simply by reading their
  Q. X( K3 A- |3 ~: Y- a% Svalue (in ring0 only). Values can be manipulated and or changed as well
7 R; f2 ^, ^3 L3 d$ Q- f/ f(clearing BPMs for instance)
+ G4 R, }. n- A* ?1 ]/ s8 w& _' H) I( p, ]
__________________________________________________________________________% {8 N& M( m# R. A9 R

. E$ V) ?; [7 [0 F& q7 o" oMethod 11
  `* r1 }" c$ ^4 j3 m* `1 V/ w=========
1 V+ x0 d! k# ?& A- a
6 F$ r6 Y$ h) J# l' OThis method is most known as 'MeltICE' because it has been freely distributed% Q2 ^, J( D. R( A  z. W" _
via www.winfiles.com. However it was first used by NuMega people to allow
7 I2 D4 M3 t+ A9 d- GSymbol Loader to check if SoftICE was active or not (the code is located" u) R' p9 ?* v; f
inside nmtrans.dll).* s8 [! o8 Q2 x/ J

8 w: d7 p3 {& ~0 IThe way it works is very simple:
% h4 e6 D% s5 X) SIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' E1 _3 I& E0 w
WinNT) with the CreateFileA API.
8 b1 u* _) c& @; l$ c
) C1 P+ V3 A: z% N; W1 o& mHere is a sample (checking for 'SICE'):
5 q; {3 n( [. j! ^3 O" X: m7 s1 |+ h- x3 C. p3 O
BOOL IsSoftIce95Loaded()3 j3 E6 f9 `; N$ k% \0 F3 O4 ~
{
# Q7 i0 v( o- @   HANDLE hFile;  
. I: ^& R8 u6 u1 r) X2 {- W9 |   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
2 S  r5 z4 T' z) V; R: i  W                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 k7 z9 d1 V1 _9 R7 P7 @6 G0 r% j
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 z  J- ^2 x- ?5 Y  x( ~/ p   if( hFile != INVALID_HANDLE_VALUE )' q, s4 I, @, O
   {0 ?( g& S% j" {& @& `1 V) r
      CloseHandle(hFile);+ c+ V, ?. b* s( H" g
      return TRUE;
& U9 q( Y6 |- L" N. `   }. L- z5 ?7 p5 R( V" @
   return FALSE;
' m$ }( M$ J- B4 }2 \* V7 y}% i6 E6 D  ~: H% \; ?+ n8 \

* {8 ~/ w$ r( x/ x# [. P6 }Although this trick calls the CreateFileA function, don't even expect to be
+ {- d* b5 \5 t/ gable to intercept it by installing a IFS hook: it will not work, no way!
/ U1 k4 }/ y/ @# O3 YIn fact, after the call to CreateFileA it will get through VWIN32 0x001F' K+ e: G. O% ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)0 W6 D: e5 V! o4 F, Z
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
! N# z& i- c  |: W& kfield.
1 S4 w1 R8 I+ A  B' I& fIn fact, its purpose is not to load/unload VxDs but only to send a
9 s# D* o: y$ y9 z  E8 NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) ]' g) q: o, b5 Bto the VxD Control_Dispatch proc (how the hell a shareware soft could try
- v" ], b( [$ T/ l/ I! f7 mto load/unload a non-dynamically loadable driver such as SoftICE ;-).% y+ e/ y+ f6 G% J" i/ g; J
If the VxD is loaded, it will always clear eax and the Carry flag to allow: u- C, e  v7 \, U6 x
its handle to be opened and then, will be detected.9 K, n; l6 j6 b  u* D4 {. S0 n; v
You can check that simply by hooking Winice.exe control proc entry point
9 {; a2 p3 U* b- Pwhile running MeltICE.( D3 d. L  b. h1 F1 d
) S, M+ n3 s% v8 j. y

8 z. f: X, [% H4 F4 h) z! S  00401067:  push      00402025    ; \\.\SICE
  W& W% n: j% J7 h  0040106C:  call      CreateFileA) r, u' w3 J5 x
  00401071:  cmp       eax,-001) o! B& Q, j; l. T) C% X; ]
  00401074:  je        00401091% r! ~- g9 c0 l; Y8 k7 N$ n
5 b* G/ l* d: r& y% r6 R0 x" d

2 E/ O* P# R! D- q$ pThere could be hundreds of BPX you could use to detect this trick.
  U! h) T) ]" t4 U* Z2 w0 j6 m-The most classical one is:
# e( B; k3 n- ^; ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||7 W9 u) e% B& k/ W) k2 @: q5 v% v
    *(esp-&gt;4+4)=='NTIC'( ^: l4 N% V! e9 a; }9 Z
( K# h5 j" o8 J% C" l% F
-The most exotic ones (could be very slooooow :-(! Y' Q3 @, L6 m  F* i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & b! L+ T3 I+ g: @5 O) p4 h; P
     ;will break 3 times :-(
( d& n# N1 w5 s" s, l6 @: N2 [
# g/ v; Y4 v" b, e& s& o- u" q1 _-or (a bit) faster:
5 O! A2 l2 A1 y6 W   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): p5 A* ]9 O# p# }. j$ P

8 m4 I9 m3 ^2 }9 X6 D$ C   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ F0 V! M% d  x2 ^+ @% D9 p
     ;will break 3 times :-(0 M3 F# y  }  r: J' u  o

4 M+ ]( X4 b. X- B9 m, t-Much faster:7 W2 t3 Y/ n' H  X" j
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 W" _* L) w+ a/ L; C( }0 ]+ F6 j8 I1 Q2 c4 x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
, W, m* J, n* P8 Q( i4 ?function to do the same job:9 |+ `$ a$ G# T& A0 ?- E6 I
* q4 z" |5 n4 o+ n* O
   push    00                        ; OF_READ5 D  \( V6 D. p
   mov     eax,[00656634]            ; '\\.\SICE',01 }5 [3 S$ o; z; u# ]
   push    eax) m$ L5 Z9 l" `# D
   call    KERNEL32!_lopen
' x, q2 k9 z/ [   inc     eax2 A/ |# O4 W: d
   jnz     00650589                  ; detected
6 w* c9 E0 @3 A   push    00                        ; OF_READ9 k$ L: d: M$ o# o' U
   mov     eax,[00656638]            ; '\\.\SICE'
: x3 E: l  [. @9 \6 ?0 y% ~9 q   push    eax2 @5 V* o% [3 p: c0 A1 Y, y
   call    KERNEL32!_lopen' L7 @9 f9 E  J7 p
   inc     eax
% t$ `/ F4 v2 `( r7 ], H   jz      006505ae                  ; not detected) Y* |. e! }+ Q
6 k0 c( i7 L2 E3 D7 Z) A

( |4 Z  B6 k$ w__________________________________________________________________________
! ?8 t) X: r9 o  Q9 ]. A+ A. y: \, G1 D8 r4 [1 f
Method 12
- @/ G0 l- T9 Z; W9 W=========
: n9 \1 Z4 i- A2 y  h  O( \/ Z
; y! K8 {/ V2 O. j; SThis trick is similar to int41h/4fh Debugger installation check (code 05) C& V% q8 a. j, Z9 N
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 k- p  ~, Y( A: `' yas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
6 |* [7 g. H' o8 w5 L% A& |) M! _) l. G; c6 Z( X) r' y
   push  0000004fh         ; function 4fh
& H1 u- L" |( X7 p- x: S   push  002a002ah         ; high word specifies which VxD (VWIN32); h4 t  w. l' |% x- v7 U
                           ; low word specifies which service
2 f6 O0 z2 z4 [3 W7 ]6 d$ A                             (VWIN32_Int41Dispatch). x2 {6 T9 l+ r, B: H
   call  Kernel32!ORD_001  ; VxdCall+ i# H" |) h& }5 Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 x6 T6 `/ }& z% y8 ?; I* S0 {2 W0 Q! }   jz    SoftICE_detected
/ L3 P6 L0 D8 ]& O3 m5 F/ S& G! _2 \. e, `. ]- h
Here again, several ways to detect it:% Q# i5 W/ f" R6 ]0 g& s+ t; e, Y

# i0 C+ i7 _2 \) ?# [: O) @/ a    BPINT 41 if ax==4f
% ?( A9 W: _+ K/ h) H/ ]7 k  J6 w$ i; a
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 E1 r* D. `, o  n. h5 b

0 I" P+ L* @2 i( U' m$ M    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ s8 |0 [5 U& I  L' w
0 y, M2 n$ }* k" d- t
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ W& q  v# |+ Z$ Z- Q* R
! c2 ?1 A% w7 o( Q( U# Y) Q5 I6 {
__________________________________________________________________________
. p9 N! }8 c7 `1 f
  s9 Q- ?) L" K# e. kMethod 13* g/ V! _# h6 ~' P, I8 \) _
=========
* W+ K8 C) T) _+ T- |; N! R( S7 a1 `) N  N% C7 L$ u
Not a real method of detection, but a good way to know if SoftICE is& |" E. h1 k) p$ _
installed on a computer and to locate its installation directory.
: w" O1 {$ L+ O+ M# E/ k+ d" \It is used by few softs which access the following registry keys (usually #2) :
& v) c& @1 e( o) e* @) {) U4 \- M$ P5 ]& B9 K" p  P
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 Y$ x! E/ a" Q\Uninstall\SoftICE, N5 K, j8 {( {3 m
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
0 [  w2 y! U. c. j; m+ I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; u2 K; e# s8 P! n$ `! Y
\App Paths\Loader32.Exe
$ f) x* n9 @4 a1 e0 u# |9 H! p9 y8 A2 Z; l  o( ?1 s/ `5 ?( d
/ q0 v7 ^3 v8 g( k% L. _
Note that some nasty apps could then erase all files from SoftICE directory3 F1 r) N; q. B) v) N/ O; t% ?. h
(I faced that once :-(
: \; x7 S6 a8 Y6 m0 K$ o/ w. |+ p9 c& Y0 t
Useful breakpoint to detect it:) R) S* F1 k" V
, g" {. A( O8 }" _
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 B+ o& B3 b! P7 G! p) u& C" k
3 }8 V8 }9 H/ b7 t
__________________________________________________________________________/ f  G* e8 }8 [3 G. c
/ w9 l# y7 r8 ]  k

. }1 `2 C) V. T$ l: `. i- wMethod 14 ; D# N9 s9 z+ U
=========8 Q7 D4 C9 i. [# \
7 v/ C: d) d: W3 @8 V
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose% u! k% A( S) j; m8 O
is to determines whether a debugger is running on your system (ring0 only).
; r+ l0 G: g: o
# U* e7 l  ?" T, V   VMMCall Test_Debug_Installed" L4 x( o- Q3 }( W  j) g+ P! Q
   je      not_installed
! q# J% d* l0 r% D0 i& H
3 y) O% r- _  l7 J+ i' A5 k0 sThis service just checks a flag.
0 V( Q( Y, ?0 e4 y7 k* O( b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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