About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 @% y6 I- p1 e+ L2 Y9 c<TBODY>
! d; I3 ^0 s1 R& u4 h: y" F<TR>: L! t$ ^) b6 a- a
<TD><PRE>Method 01
* L4 R5 k! h, U' y1 ]: R=========
0 X- R2 {* l7 R0 n# i( X
; r% f% n$ _# Q% Q: _7 ^% I  bThis method of detection of SoftICE (as well as the following one) is! h5 M9 d6 T& r" }2 C: X
used by the majority of packers/encryptors found on Internet.
( G( P; @& D# p/ H9 O, Y, g+ AIt seeks the signature of BoundsChecker in SoftICE; Y8 n- d* n4 x3 k. |

6 Z: B7 b# A, @# F9 w4 p    mov     ebp, 04243484Bh        ; 'BCHK'
8 g6 p0 p+ s' U  r: ?, I+ E6 d    mov     ax, 04h! V, M6 s/ \0 s( y& N3 z
    int     3       + k( e) i+ V3 p6 S9 n2 s
    cmp     al,4
, Y" I( D0 D  v2 p. {- p3 |4 @& c    jnz     SoftICE_Detected
( D9 S0 d) O& m2 _$ l. Q  G
. o2 Y# [. j: S% Y( C0 h___________________________________________________________________________2 v/ j, `2 F& J- V

' L, M* k! P9 Y& l" b/ b) P* uMethod 02+ v- `. K; o* w* l' D2 n0 P. g! b7 w
=========/ z6 P+ U  |4 ?5 p3 i
* f, l# p4 x4 U, Y
Still a method very much used (perhaps the most frequent one).  It is used
$ {' s7 C9 y* ~. `5 O, e# Qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,) C) _; M* f$ B; N" M9 G
or execute SoftICE commands...
6 L& k- T8 s/ O: [4 j! \6 TIt is also used to crash SoftICE and to force it to execute any commands+ f+ u# k+ i, j% e+ d
(HBOOT...) :-((  
$ z) r! G( w* R$ U1 V0 |& ~2 h: y" N- U- Q
Here is a quick description:  t4 A. l, t6 X
-AX = 0910h   (Display string in SIce windows)
; z  m+ m6 S' V! g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ [. }$ N. Q, E  {6 O4 D1 P
-AX = 0912h   (Get breakpoint infos)6 J9 }+ d# f9 X! l1 B) j
-AX = 0913h   (Set Sice breakpoints)
$ L6 C* k6 M8 _% E; W-AX = 0914h   (Remove SIce breakoints)/ w# `7 f* G/ o) |: D- t, I; I
0 m6 S- N# _4 B% S- [1 U6 t
Each time you'll meet this trick, you'll see:
# o3 z: H2 g" {1 O! ~  G-SI = 4647h
0 X5 V  e. K. h. s1 s+ b4 _# L-DI = 4A4Dh$ u9 V3 x$ J; ?" x( ^: Z. Z
Which are the 'magic values' used by SoftIce.
6 j- z8 |. B8 G4 y# t% OFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 \5 @* A9 \1 ?
' x- x# c* g# O# n: _
Here is one example from the file "Haspinst.exe" which is the dongle HASP
9 f- p- P0 P0 w' l! T& KEnvelope utility use to protect DOS applications:8 G' s; Z3 k+ |4 A# H9 ^- d

1 m+ \' `. p  n5 o' _0 K( m4 R1 v3 R3 w0 n9 w  Y& P+ O$ t
4C19:0095   MOV    AX,0911  ; execute command.# c$ W( Z& @/ w  U$ V  f+ H( r( z
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).! B0 d9 d& X. Q7 Q' q
4C19:009A   MOV    SI,4647  ; 1st magic value.
! g' t$ ?" y; Q( E- J# x& P4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& y; a+ n+ V3 h! K% m* S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 }8 `% ?& K1 M/ o/ e3 r  X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
- M0 G. w- H0 j7 ]! R, y; v4C19:00A4   INC    CX
) R6 v  k2 b) T/ `- [/ t, G/ S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% I7 J, N) |6 i" J/ Y
4C19:00A8   JB     0095     ; 6 different commands.
' X" ]5 w4 [0 \$ c- a4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
3 u! }  _! P/ u' R( r) W4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
9 e. Z& o! L+ D  ^& d: M9 k' V9 P3 X- y. ^& u" s* Y
The program will execute 6 different SIce commands located at ds:dx, which% A9 D" m% `. K( |: w3 f+ G
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.( J1 D: L, Q* z1 D- [$ j9 \% g
) T4 }/ U3 ?3 Y  i8 `/ M* A
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' i# w4 ~4 v3 E$ ]7 R___________________________________________________________________________% m/ b% ]1 C6 Z4 c8 k2 L
$ [5 n5 F6 d+ ?  h* E

9 R1 ]# j* `! b3 E. B* j" oMethod 03  ?  J7 U& y! s: A, k0 H, ^
=========8 g* f1 R  V" b0 E# u! Z2 Z! U

4 T, x5 n' @6 X9 V: GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
$ |2 k) O# o: [0 Q: \  ~(API Get entry point)1 _9 P1 T# q' s; w* y7 E  o8 n/ F
        
; H# t* U4 m+ K' d  M! ]! i! d9 Z5 |
3 _* J; f7 j& Y  A4 H# X; @- e    xor     di,di
9 Y+ I; }/ K9 I5 N; l9 r+ G# m  i    mov     es,di
5 A  G0 E0 h9 s    mov     ax, 1684h       $ N" a) K3 F$ I9 g7 m6 I5 g. M
    mov     bx, 0202h       ; VxD ID of winice  ^' S; t+ ]4 K% X) D5 X  V& p
    int     2Fh! a. g( J2 ~1 K; w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% D4 h: U9 @- M5 D# j' k- i    add     ax, di% s2 _8 u1 k" j$ F- k- f
    test    ax,ax
; ?% j4 ^) _# `  ?2 D8 A    jnz     SoftICE_Detected8 x) _3 _% P, ~$ I
* _+ z% _4 j' v( O; T
___________________________________________________________________________
" F$ R! W% I! x4 s  e: t7 O' h" O# G8 u! z5 `
Method 04: q0 W* X7 T' Q( M9 K! X
=========
6 N+ P4 S5 @- `$ z2 r) z$ Q2 M6 M6 T: }# i& G
Method identical to the preceding one except that it seeks the ID of SoftICE) ~( {0 \8 L, W  q+ Y. I! T
GFX VxD.( J/ s2 ^4 \$ H5 q* I
- z6 Q& Z4 p- v$ j* S
    xor     di,di
: [7 D7 j/ a+ e, B    mov     es,di1 D1 @  n7 a# E9 f' _! H$ j6 I
    mov     ax, 1684h      
) T* F; B9 q$ V# ]* f9 M% q* w" V$ }    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 n8 Y0 D2 v2 y4 L! I
    int     2fh
$ u% z* x' ^- v, h7 K+ ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 @. ?3 j) W) W( b" o    add     ax, di* c6 F& m4 }0 C6 U- ~% w5 s4 x
    test    ax,ax, H4 R+ P$ e) B0 w, {
    jnz     SoftICE_Detected& Z3 j. B. g# E

0 Y' Q! l0 e3 d3 I$ }4 ^9 f( @" G. T__________________________________________________________________________
2 b6 D' \* R6 n( l0 v5 |# Z$ ?" B
+ h$ _3 e! h$ F: e* I6 l! y
7 A' O3 K  B# \% K1 B- Y, qMethod 05
, e, u; ]  K  Q' K/ M=========
% m. X8 {+ X9 m" [4 F. y! i5 K  L9 Z' H+ G
Method seeking the 'magic number' 0F386h returned (in ax) by all system8 Q. f% b; E. `( q% M) R  c  b+ O
debugger. It calls the int 41h, function 4Fh.
- L) S: e3 B& L/ w5 `( `There are several alternatives.  
" M, L  a# v/ e3 X4 z0 h3 _! v' y# W- z$ u, k* H
The following one is the simplest:
6 a2 p5 n- Y( D. I- X
7 P- q7 b" W, l( {# L) i    mov     ax,4fh' h) g7 g+ o, O1 M+ A' }# p( \
    int     41h& Y3 ]3 Q" u/ g6 W, y. D
    cmp     ax, 0F386
3 V$ ~& \. h4 {* U    jz      SoftICE_detected% i  E' [% p4 ~& v
4 {' m3 J9 ^+ I* C3 o# @1 @( Y

% [6 o. Q  a& e+ l' ], LNext method as well as the following one are 2 examples from Stone's
' \5 \0 @" }( N7 v$ K3 l( j"stn-wid.zip" (www.cracking.net):
. |9 j  I3 q# l
0 `* {- \8 }" |+ I. O4 g    mov     bx, cs
: S: J' ~5 y# r# Z9 _9 T    lea     dx, int41handler2
; A, A" \. N: R3 a    xchg    dx, es:[41h*4]' s! ?8 r. {& n
    xchg    bx, es:[41h*4+2]: T6 s& G# n; m6 |$ @+ g; }
    mov     ax,4fh  T! g) o6 ~4 K( v+ Z
    int     41h
) |6 J" B* c1 A# ]5 p! n    xchg    dx, es:[41h*4]3 x: G# }! l7 Z; I' I# F; T
    xchg    bx, es:[41h*4+2]
+ q9 ]6 }# q, W    cmp     ax, 0f386h& K7 t: n$ {$ Y( W# ?9 P& s$ H0 \
    jz      SoftICE_detected: i/ K8 m/ Q% W' h/ o* ]

/ r0 p4 ~( {2 Aint41handler2 PROC5 b2 @" V  j1 p' L( u
    iret
' E. m2 I  E  Oint41handler2 ENDP; B& k* H1 R* h- ]8 p) j. G1 {" k

) L; g/ p# Y0 F5 c) R. Y5 Q4 z0 M8 H
1 v( a- g" h* w! E8 J_________________________________________________________________________
. l, Z+ z6 T' X1 T8 ]8 Q$ B
, |# I) V* G6 V$ J* A' ?& q) U7 ^3 h+ _- X
Method 06
4 l6 W9 m4 z6 K, S5 [- P1 Z=========! g, s% K% @5 S

6 i# M7 T  `* j) ]3 q: D% u! d9 d( j1 f2 C/ a- F2 Y4 Z. E% r
2nd method similar to the preceding one but more difficult to detect:
4 S. J1 \) s) j  [5 K: d. a; I3 F$ a% w! x

, |( g; R; }/ j5 }& d2 D+ `8 Kint41handler PROC
& P, R1 \0 {8 }' Z) A5 r' |    mov     cl,al
+ o0 z# _* V( e6 Y/ I/ ^    iret
/ ^$ {8 [& w8 D; n9 |# i6 Z8 sint41handler ENDP
) q+ Y, n0 D# x+ b# P
' M4 O# q$ h7 S4 }( z$ V
4 I: H+ p- B- u# {4 e    xor     ax,ax  g! k# l# I, T# h; C, M
    mov     es,ax3 U' U! b+ `8 t
    mov     bx, cs
+ }" w! A; v! B    lea     dx, int41handler
" M6 z: q& T! n5 ~    xchg    dx, es:[41h*4]: \2 q. _4 E) h  }
    xchg    bx, es:[41h*4+2]: Q$ j9 B7 d3 k3 s; |' C4 V
    in      al, 40h
/ L9 `0 j  g2 M3 m2 V% _5 n% z4 l    xor     cx,cx6 v- n. S2 [6 D+ D$ [
    int     41h' e: d. a( G" r! @! O) u
    xchg    dx, es:[41h*4]" `3 g9 B3 u3 T. R" N; t5 o
    xchg    bx, es:[41h*4+2]" ?  B+ H3 L7 S4 |; P
    cmp     cl,al  H% O% m% i, a
    jnz     SoftICE_detected
8 |" ~# u5 ]( ~* t+ @5 g7 m6 c5 R4 s0 O/ }4 u# p
_________________________________________________________________________
3 K( e2 _& Q  |
3 T* [/ s9 e* N* S9 S$ H: r9 IMethod 078 v; {' |6 N& o# L
=========
: P  f3 x8 F* v1 v7 N
+ q1 ]! J2 c. F* A! qMethod of detection of the WinICE handler in the int68h (V86)
2 i. g: L, x: B+ @8 N
% L( _2 V, X9 a+ `9 Z% J    mov     ah,43h
4 H% |: Z6 L* z# R* T5 |, O/ U    int     68h/ t; P: P: P0 ]& M+ I, Q  c0 a
    cmp     ax,0F386h
8 X  H) R2 ^' I; |5 q    jz      SoftICE_Detected
8 ?7 D" B9 E  f5 D
1 @6 p* I! |9 J( n1 g: c5 T# h) T  H% v8 v: h: E
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit+ ?" n7 ~. B4 w: ~3 N5 _
   app like this:2 P5 T. c- T1 L  W. ^0 m

2 _) ~0 t3 o; h, T8 |- S   BPX exec_int if ax==68
0 ?9 N9 [+ h5 ]9 j   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ }0 U9 A/ |# E   located at [ebp+48h] for 32Bit apps)0 C! s* ^+ K0 v1 h' }
__________________________________________________________________________
3 C5 W4 |2 z  g- I. b# g
) Z/ q4 D3 G$ x4 y4 |" b3 o
! \2 F; x" Q; s+ L% y5 V% c4 LMethod 08! F  A" _2 A/ z! L$ L% e
=========, _9 d" m( y) C! h6 H3 o; C8 Y
/ Z5 ~2 p/ [8 I+ K3 [
It is not a method of detection of SoftICE but a possibility to crash the
2 E+ D9 ?1 ?" @0 psystem by intercepting int 01h and int 03h and redirecting them to another( Q9 K! w3 f& V4 F, Z8 W. ~
routine.) r" G, b& z0 q
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: u' i) r: ]9 h3 k1 \4 Hto the new routine to execute (hangs computer...)8 T' b' A3 ^3 F% x4 M; _

0 \/ u" S, q7 e+ Q/ ~& v2 K% S    mov     ah, 25h
+ a& [6 ^& b! C/ L( ^7 t    mov     al, Int_Number (01h or 03h)! x5 O( K5 R/ H; [
    mov     dx, offset New_Int_Routine6 B. I9 ~! H, l- K
    int     21h
5 S+ o6 b# O$ q' V' O/ C  z4 x; D+ P
__________________________________________________________________________: a) _  v" H3 v$ c+ Y
- ~8 G3 ^: `- X( M- q' j. m3 |
Method 09
- `- @" k  i; K! y=========3 `( ^: G. T- R/ q% P  m- e

/ L/ u) ^5 n7 J5 cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% {# L6 b; h7 j% q3 aperformed in ring0 (VxD or a ring3 app using the VxdCall).
& }1 ~8 @! D) B# P8 w8 ^, YThe Get_DDB service is used to determine whether or not a VxD is installed
! t7 k( k, q7 n3 ffor the specified device and returns a Device Description Block (in ecx) for7 f0 Z  V5 Y! m8 H. b; w
that device if it is installed.
$ s" L# ^2 i6 G* a7 I' g# p, E: M1 A( J" X. P
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID% `7 l7 n4 C: p$ i
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)2 ]" X$ c- s# X; D+ u( ~
   VMMCall Get_DDB! ]! K2 I; U9 P# o  w4 p! x1 V8 a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& j0 E3 g* S* n% C- V! K  ?$ w0 W% P2 s
Note as well that you can easily detect this method with SoftICE:' F1 Q1 d8 L# v/ G
   bpx Get_DDB if ax==0202 || ax==7a5fh% U& a% O( [, q0 N" p( P& j
' j4 `+ e( p) i9 Z5 h
__________________________________________________________________________
) O& K% W, I9 }8 y  v9 s4 i
1 b* p: D6 K& a8 Z1 qMethod 10
: V" d1 a0 \. G1 i! P& j9 T=========
& I8 O: s3 e( e2 p+ ]+ x
8 U/ D1 e, W3 r' h=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! u7 l: Z2 N$ a
  SoftICE while the option is enable!!0 L* l  e- N1 f+ }! N6 }
# ]+ x5 Y, g' E& L4 U
This trick is very efficient:
: L$ W. {$ W6 S5 x% Y8 @by checking the Debug Registers, you can detect if SoftICE is loaded4 q7 N1 Y; I- F: N& |8 D- d
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" ]/ e# f6 F) O  P+ q: A& v3 _5 uthere are some memory breakpoints set (dr0 to dr3) simply by reading their
3 l. t0 b+ ~' x+ l: |9 \value (in ring0 only). Values can be manipulated and or changed as well3 U. o( X0 ?0 n' e, c# v
(clearing BPMs for instance): D) z* Z# u: r1 \  X7 f; Y* L
7 I* M7 `! F6 P( S& [4 ~, }- r; e( E
__________________________________________________________________________/ z: v' e9 L  n. G. E/ p- c; ?# ~. a2 \

; R/ F" G; q- RMethod 11* D+ k- H0 ^) J1 O' _$ A
=========0 r+ }/ T& Z9 \3 \* y" i' R- W

  g  y8 ]4 k% g% u3 g% R8 qThis method is most known as 'MeltICE' because it has been freely distributed* n$ O  x, C% f( R- I: R
via www.winfiles.com. However it was first used by NuMega people to allow
' X$ a% K* x+ ]$ wSymbol Loader to check if SoftICE was active or not (the code is located
1 S; a6 `  _6 x' Q' V' X7 Jinside nmtrans.dll).
: Q+ A8 d4 ^, {2 x0 f) {: O* {
- N: O- M% W/ i0 C5 r' }The way it works is very simple:. ?, F! M/ v3 _" b4 d
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 r3 A/ h8 ^; M. I: j" L
WinNT) with the CreateFileA API.* w9 n8 j9 G3 ~0 [9 S
+ _) Q5 k" s  t2 S% e5 Y
Here is a sample (checking for 'SICE'):
, \6 T3 r5 ~$ x/ c+ J5 d
8 d( E9 ^4 i, h9 X5 nBOOL IsSoftIce95Loaded(), p: q) t1 o: @, D" M5 v% r
{# {" Y# _1 z0 E% l. _6 J/ y; t+ _4 G6 }
   HANDLE hFile;  
0 l1 x2 C  E4 O6 \  U& x" n% F   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% ^( o  f& |8 D- e$ ]( z% U; F
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) n0 W8 P3 x1 E+ o( X' o, a
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
/ K8 S- @: j$ G  j' h, I9 ^   if( hFile != INVALID_HANDLE_VALUE )  j6 G" A& k2 D3 e
   {
* ?1 Y$ D* `# W# r' Y; B, y      CloseHandle(hFile);
7 r* ^. r7 d( S' M: @7 j      return TRUE;; V+ ?$ K' m# p
   }
# h$ Y0 x6 l5 y+ v8 S   return FALSE;! E; Z% r+ F0 q3 l% e( Z
}
0 S2 o1 [/ M! ?8 J/ v( n) b6 i" a3 d
Although this trick calls the CreateFileA function, don't even expect to be
# P# U2 g) c  _( |$ Yable to intercept it by installing a IFS hook: it will not work, no way!) H# r: A. E/ z, E
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, @; _9 f/ i+ f$ u! M% r- mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# r" U3 N0 A) |6 _( g
and then browse the DDB list until it find the VxD and its DDB_Control_Proc% x; h9 j# z2 K
field.
+ {  G7 ~1 b+ g3 }, E7 `In fact, its purpose is not to load/unload VxDs but only to send a
, [2 C# @/ h' \W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. O( S( R- g# P5 y& L+ Dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
! \& u* |6 L- z" Nto load/unload a non-dynamically loadable driver such as SoftICE ;-)., u' ~1 K* U9 M
If the VxD is loaded, it will always clear eax and the Carry flag to allow' A$ P. i: c, L. O! g  ?
its handle to be opened and then, will be detected.
1 o' w- l2 A7 w8 }0 hYou can check that simply by hooking Winice.exe control proc entry point, Z; `/ B, [: ^7 b0 C( P5 Q
while running MeltICE.( Y9 V4 Z  |2 `2 v2 k

, ~  k! `* Z: Z3 g/ a
2 M3 ^  k& v5 l4 P  00401067:  push      00402025    ; \\.\SICE% I6 f& \; g2 ?. s8 m, P
  0040106C:  call      CreateFileA
% }$ E0 r& Z( g0 B3 h  00401071:  cmp       eax,-001
; Z( V$ Z: d; M( X2 T  00401074:  je        00401091
& A0 V. T8 x7 F8 n( D
  y: ~/ p. g3 w6 ~4 A
$ l2 n1 E/ S3 m* a( j! L1 J+ UThere could be hundreds of BPX you could use to detect this trick.3 Z4 N$ q- A5 ], t' T, N+ x" D
-The most classical one is:  K% b, `/ d* M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ X4 T* e1 n% V5 V0 u/ t' k* @
    *(esp-&gt;4+4)=='NTIC', |4 b( s) d& O$ S5 O# x

' ^4 W8 [: T, O" o1 H7 ?' l-The most exotic ones (could be very slooooow :-(
' d* h1 _( W% I. v; q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( a2 s: h$ y7 [' \     ;will break 3 times :-(  `' J( H8 J4 K) n& X3 J
2 }: U/ k+ ?, z% v
-or (a bit) faster:
9 @: i( T" C5 h+ X" t: {4 h( d! @   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
& ]$ l( s: U5 }$ Y3 M7 K6 j
, x* R$ x( n/ f0 z; S, m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) Z6 ?1 W% k( H
     ;will break 3 times :-(, g& ^. w1 R$ [% D" ?7 g1 G& T- G

: J0 Y" K2 \, ^- N-Much faster:; H$ j% t5 w9 E
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ \. R, R2 J6 s* c

; H" w+ f1 N2 hNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% N9 F* O6 c; ^( p1 A
function to do the same job:' ?( i$ D( B, }* m( H" i& Z8 K, S

: b2 |, F9 w3 D* z. N! S8 j: S( @   push    00                        ; OF_READ
1 K- N! e! P$ p   mov     eax,[00656634]            ; '\\.\SICE',0
. r% w8 S" U/ A# g2 D9 S  _   push    eax5 u0 v. F0 A+ G6 ^: p6 S0 x
   call    KERNEL32!_lopen
) J; e. \0 \! z- k   inc     eax
2 S9 h6 W  f8 K  y2 Q1 _   jnz     00650589                  ; detected
) S5 U( a8 E  x- k! G) y; u   push    00                        ; OF_READ
9 C. Q8 ~. T$ G# B) D   mov     eax,[00656638]            ; '\\.\SICE'
* q; A# Y8 ^; O9 [2 Z0 h   push    eax& f' d9 h$ n3 l! n+ u. V
   call    KERNEL32!_lopen
/ B; B+ f- M1 z: |9 ]: \0 w   inc     eax
" i6 I3 G+ n0 }! a& N7 N- q   jz      006505ae                  ; not detected; q! c2 q1 u5 _, C) t0 W1 ]& F$ ?( I+ b

6 b5 Z% `8 u% `! }2 Y; K- u( p
% W/ Q3 P5 p( K% |+ w/ s  Q. e__________________________________________________________________________
. u7 q4 Y5 r% m! j( S3 W1 b$ \
  Y) B; {8 H# W* H6 ~* @% E3 [" I3 mMethod 12
) @, }7 ]8 @, x: x=========
' C/ W, ?" {6 i6 M# |: O3 k5 c3 k, T: W3 A' }- ]
This trick is similar to int41h/4fh Debugger installation check (code 05
* U! w. E; y4 @- _6 t&amp; 06) but very limited because it's only available for Win95/98 (not NT)! W: d! v4 ~; @1 T' z% k  `, G
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; M7 v0 B; s$ Y+ n& z# N
' R0 V# x. k% ?6 k1 V6 v0 Q) p
   push  0000004fh         ; function 4fh  f9 o! W% U: Q# D8 b9 a8 j
   push  002a002ah         ; high word specifies which VxD (VWIN32). Y1 p- M6 U+ T4 k3 j9 Z
                           ; low word specifies which service
! e' \6 {2 m5 o) D! S; x) p                             (VWIN32_Int41Dispatch)' R5 ^0 e3 A1 Y: r
   call  Kernel32!ORD_001  ; VxdCall
' O) D: K" B* r$ u3 v7 A/ V* }   cmp   ax, 0f386h        ; magic number returned by system debuggers
- h, l6 w6 X/ k, |. W   jz    SoftICE_detected7 Z3 V% C& t2 D% K1 T4 @6 ~

# q# E2 ?" O6 H8 H7 U6 ?3 YHere again, several ways to detect it:
; B1 W" ?* s: p2 M% \5 ], j2 e% v% D, u6 w2 Y9 K/ Z# X
    BPINT 41 if ax==4f/ t/ o. S# {9 L+ q1 |2 i
& P: N, J! z0 j) M, K/ q' ]
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ G; O4 I# Z( J
1 k$ X6 C2 j- e# A
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 Z& p! W, t0 t8 }, z0 U) e4 ^1 f' [
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 K. T9 F6 |5 L0 d

& b  q! N% _6 {$ u& e__________________________________________________________________________
! L. |$ W+ N" l) s1 R# K0 z  p" u. T# Z- O" e8 g
Method 13
8 _; \: M1 x* d% e=========0 H' J/ v5 V- p
8 m5 F( F6 [- U( X
Not a real method of detection, but a good way to know if SoftICE is
% u4 y6 w5 t- }! i+ v+ Uinstalled on a computer and to locate its installation directory.
1 t: @. t' t/ [4 [It is used by few softs which access the following registry keys (usually #2) :* A* i' l1 {0 \9 q' V* s* E

0 a1 A/ |8 k: t- N, J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" i  Y" e5 O# j2 ]; G" B- v. @
\Uninstall\SoftICE
* c  V" {! F9 n9 t5 h-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* C: P. d9 `. @+ d  ]. I0 `( M- W-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- L* i! C' T* b" [# n1 J! U\App Paths\Loader32.Exe; k  `0 W9 G( u3 ]: @5 B

; s* {0 Y# T9 h4 Z1 }, ]
: e5 b/ Y! U  ]& x; HNote that some nasty apps could then erase all files from SoftICE directory
9 o! i7 {+ j3 O! K+ g4 e(I faced that once :-(
6 t8 ~7 e; V; _* ^
0 U  t8 g0 n* r' A* I" i$ I, gUseful breakpoint to detect it:' K6 A8 D! F- G% g) n

5 u9 y) ^5 [  f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'" S  t7 w, u. {; ~6 B* j: u
9 {# F0 C0 Z6 ~7 G  M
__________________________________________________________________________6 p; ?# D) {5 G& s
6 ^" @( |2 |# O; u2 x
6 r5 f. W3 g* z# B1 H( B6 Z
Method 14 / I7 C4 G2 m9 y7 q' b
=========  L7 o! C7 U0 g2 e( U1 \
4 V. N& q. x' c  V" J+ z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 N! W6 B2 g% p' x+ Z+ {. N/ |
is to determines whether a debugger is running on your system (ring0 only).
+ y0 w8 z; W3 T2 d( t% ^' e) [; u, j# x2 J. q8 g1 H
   VMMCall Test_Debug_Installed
) x# `% [6 Z/ @9 M8 j: W+ P! B2 v3 R   je      not_installed. a" d# \) R& |+ T- {

3 _2 z) N+ i0 X) c9 M& a; qThis service just checks a flag.
( o: W7 Z4 T: B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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