About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ U7 X% J. J  t<TBODY>  S. b- z1 j/ ?5 I9 {, ]
<TR>2 P. G4 t: D$ D
<TD><PRE>Method 01   ^2 I- h& F" E, @" U
=========) B$ ?; d( B9 c# C5 W# {

0 E1 Z7 w- X' {9 }( f/ b5 SThis method of detection of SoftICE (as well as the following one) is, G) ~) `$ \- p/ d. C, ?
used by the majority of packers/encryptors found on Internet./ U/ w) r+ x- I1 s8 @
It seeks the signature of BoundsChecker in SoftICE
  N* o, o, G3 P9 l6 t5 R: Y1 l! T+ U  n. R
    mov     ebp, 04243484Bh        ; 'BCHK'+ z) u/ a: W5 U$ F* \6 f
    mov     ax, 04h
% h& P9 C7 A# v0 i" I    int     3      
1 t- M: e/ \$ f6 g    cmp     al,4
: L, K1 O3 P+ t, w) k    jnz     SoftICE_Detected
# B' h) I; K/ I# o# \/ H3 X
9 X2 @6 L# T8 S# d4 S( g: c3 s___________________________________________________________________________$ @2 o, N  y( r# b% H8 w. K+ P

9 o6 D' y( t0 A9 H7 z0 x' vMethod 02. S; ]4 |% U' c" U
=========
1 I7 @, w( j/ g$ D6 i" M5 p! ?: E% H- a5 x! w
Still a method very much used (perhaps the most frequent one).  It is used/ f3 ~* s& U) C% N" V
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ O) s4 t+ R& k) y7 R2 ]
or execute SoftICE commands...
5 S* o2 S: s, l7 N$ Q  I6 k* V. bIt is also used to crash SoftICE and to force it to execute any commands; [! ]0 B7 S6 B, S+ U6 n2 W
(HBOOT...) :-((  & D; g9 X$ X5 Q3 C& B/ r, I
6 ?4 ?$ T$ u; c6 k! k
Here is a quick description:
/ h9 {& k! t, R/ U' D6 \. p, C  W- O  p-AX = 0910h   (Display string in SIce windows)
% z& o' j' Z7 x9 p-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 I  \0 @) ^( o3 u0 U
-AX = 0912h   (Get breakpoint infos)
! G& A3 p0 v, x-AX = 0913h   (Set Sice breakpoints)
/ e5 b+ i. ?1 l. N2 I-AX = 0914h   (Remove SIce breakoints)
. F9 ?8 g, R" R2 v4 P
3 t! D7 v; c& YEach time you'll meet this trick, you'll see:
- o& p7 K$ a! g+ D5 L" f2 B-SI = 4647h
' P9 C! d' b2 m% S( u-DI = 4A4Dh
- V3 ^7 F+ W$ I* wWhich are the 'magic values' used by SoftIce.4 k# c$ N! D1 I- d/ k/ U
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.) t% c4 r' t0 D: w; r; \

, {4 u8 o9 [) b" UHere is one example from the file "Haspinst.exe" which is the dongle HASP
! ~3 Y/ y$ E/ O  Q3 ~: O& [Envelope utility use to protect DOS applications:
, p& F1 I0 W' Q% K6 Y. `4 P, ]; |

& ^4 T, d* ~4 O. b4C19:0095   MOV    AX,0911  ; execute command.
9 H  a' ?3 t1 `7 P& g0 s4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 F: n6 e! Y' u. r/ @# K; L/ i
4C19:009A   MOV    SI,4647  ; 1st magic value.0 D' m# @. ^4 P( X1 W
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  j' n: v3 u, Y$ r
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 b! r* E  N) |: \* O# P8 L- Y1 V
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! W/ P# v, m+ T4 a; v9 K% [7 e
4C19:00A4   INC    CX$ L- U* c, {- D% |. f. a7 N. L
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 @. ^; Y, D* C- m$ y3 J/ N
4C19:00A8   JB     0095     ; 6 different commands.! F7 |6 ]0 l" p3 E
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' F1 J& C, i  ]$ [' o" ?! i) T4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! b! t; U( C4 [' v6 J

, H, n; R# q" |" V7 ~The program will execute 6 different SIce commands located at ds:dx, which8 h7 k& p9 c# p( ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 w/ }  O: x1 \, m; A( J

' p0 \) l% a5 Q. ~' g7 V* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! u* ?" i4 m6 K+ x
___________________________________________________________________________
: j- H+ E+ p/ N  |. [+ j% J. \
  e& p5 {- O' X1 n3 y' }
0 ?3 N6 C8 W8 T. O1 }8 jMethod 03
+ }$ V! H+ \6 d# o. m=========
+ j9 ^: z0 g* C! g  g% f3 H" j, T4 J  A- E* e4 ?% P( z; v, t
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ E- H  ^) u' E, c* W/ K# l' S# [
(API Get entry point)4 ~/ W+ m! [; K" l3 x
        
2 |$ b1 h5 B7 i- R9 J2 f8 H; j, O: g1 V5 ?4 r; C( p9 u: d4 Z: f
    xor     di,di
, s: E" u3 u5 s; Q4 @& d    mov     es,di5 G; U& G( U( W& g/ ]1 p
    mov     ax, 1684h       ) E% R/ F3 i; T9 \
    mov     bx, 0202h       ; VxD ID of winice
6 D  g! J2 _1 l' s    int     2Fh
( h8 W0 o: U1 k" e1 t' x) b+ A4 p    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- X! K9 y8 v5 P9 `: q2 G& _6 B    add     ax, di# ]6 O/ _5 B& g
    test    ax,ax# e& y2 V) I, V/ ?
    jnz     SoftICE_Detected7 B8 l0 [4 P0 r7 R% [. Y0 d8 U3 g
0 v) O+ Z& g+ m% _* Q  b) [
___________________________________________________________________________! S. K6 t, c, r! {
" g' Y8 V5 u; X, q
Method 04
; G! f6 c' h) `; N=========* G& s9 o# M  T, o

# _1 X5 b$ ]7 P1 w2 S( UMethod identical to the preceding one except that it seeks the ID of SoftICE. j2 t9 G$ P0 \/ q1 r  ~
GFX VxD.
" c$ G0 }3 J6 d% r8 q6 F3 Z
+ E0 r7 d$ o* Y) \5 ?5 }! L    xor     di,di& f$ h) ?0 o% y  |% s
    mov     es,di8 O8 L4 A' C+ g; e6 I
    mov     ax, 1684h       5 K% k# t4 v2 d/ c4 Y6 [
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
7 t$ |: A/ ^" O! C3 N+ Y    int     2fh+ M) Y) K& F4 y/ k. J7 f7 o
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, S% @6 e, a0 @+ g) R; r
    add     ax, di
3 p: }4 ]: q/ O; r    test    ax,ax
; V; h& n/ w- E5 G. P/ R5 o5 `/ [0 v: O8 j    jnz     SoftICE_Detected
7 H" R, a& X& z2 U$ \. z: @' Z8 Y9 w8 [  U0 Q; R( x! g
__________________________________________________________________________
! d) P+ h# r8 e! G' p
0 ^5 ^1 C9 x9 \7 |- `- W6 G* _. A; F  c: d( q
Method 05* ^/ L# U: k% }7 E- u
=========# N0 @! a& H% S: F  o

* ^; [; w* q9 l$ z: U! m7 KMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ b$ n! {, \% Z  n: z! m3 c- ~2 \
debugger. It calls the int 41h, function 4Fh.3 L8 S+ X% ~$ ^( @; H3 s$ k
There are several alternatives.  2 J. s  U, O+ U' w
& M8 S+ h% `2 X5 L( B3 R3 M1 c
The following one is the simplest:9 Q! }2 ]. O: \8 R
. {1 q; \: O' q$ g2 A2 Z
    mov     ax,4fh
0 r3 G3 o% D& l    int     41h2 ]/ i% `& @) I, h# u# t# {/ Y
    cmp     ax, 0F386
/ b1 S3 I$ e6 m3 {, J) v% V    jz      SoftICE_detected
9 h/ K! m+ L$ Q; |1 C/ i* S' ~0 N- m+ Y
. ~# H- ]; S/ d4 E. n3 A" w
Next method as well as the following one are 2 examples from Stone's
% N( P. {- Y( `; o7 K! ~"stn-wid.zip" (www.cracking.net):$ j9 u% q- r! X8 P/ ]5 M7 v2 _
: O- v' l. L  x" u& ?/ X
    mov     bx, cs
9 J& Z' X7 z$ U/ ?) U8 l0 J/ Z( B    lea     dx, int41handler2
* m( O0 S" n8 y" j. X" C! H( @    xchg    dx, es:[41h*4]
' A9 _5 h) c* R- Q    xchg    bx, es:[41h*4+2]
+ h7 o; o  b- K5 R& H! P: |    mov     ax,4fh
7 L: m) \1 E+ f9 V2 x    int     41h9 u; \6 Y% q. j/ K4 \
    xchg    dx, es:[41h*4]$ s/ P. D& R8 `7 K
    xchg    bx, es:[41h*4+2]
! C# Y$ C+ h5 Y) j  [8 x2 y    cmp     ax, 0f386h
8 j" B0 S. `  F    jz      SoftICE_detected
0 u9 Z- J  W! H0 h" k- Q* ?8 w6 L' ]& G
int41handler2 PROC
) E, }/ a/ B( C4 @- k    iret
2 n  F+ C9 ~1 d* {3 Jint41handler2 ENDP1 D# _8 K" d1 }1 D; \
  Q% ^: O0 ]0 P& J

& A6 R( s2 b( x/ @_________________________________________________________________________: k0 l: H/ P& @3 |) A8 q
; l/ {8 y5 c& G
3 Q' J" @6 k5 }
Method 065 W5 N6 X" [: \. j$ v, t* j  m
=========# M' X. l/ Q6 Y) Y$ _1 P

$ ^/ |1 w  W! R6 O1 G# j
8 K0 |8 _/ Z6 z2 ~( A/ y) O2nd method similar to the preceding one but more difficult to detect:. ^) S+ `; l+ A6 L+ V: U' B2 y) ]! z

' v" Q# D, V5 e: i% T* O+ g$ s" H% S1 }) \% _
int41handler PROC$ l3 j8 a6 Q! Y: }# q: `
    mov     cl,al" _' H+ d  K, M+ u- F3 `2 t1 e$ N
    iret
* C' w$ {0 ]& r+ h: b: y+ X5 dint41handler ENDP# [1 X6 G" o5 v
$ ^* z% T% L, a: F* s2 K
9 O( v  P+ D' N7 t- c$ q! q$ D
    xor     ax,ax
: R0 W/ }* J5 U7 a% M" F6 S    mov     es,ax
! y& v; K" z6 z    mov     bx, cs1 d6 i" |4 Z: [/ k( i& d0 D
    lea     dx, int41handler
$ j7 G+ x/ v" ]1 x0 P& X8 K  q    xchg    dx, es:[41h*4]
! u& }4 E3 [/ Q- p1 }    xchg    bx, es:[41h*4+2]
8 p4 F1 O6 g5 G3 n    in      al, 40h: i8 D1 g' z  N0 `6 L/ \
    xor     cx,cx: N; f- [! f. e; T5 F, p
    int     41h
9 T8 g3 |4 f, f; l- T* d    xchg    dx, es:[41h*4]
- K& c0 @, S7 u2 M$ q7 x9 [) E    xchg    bx, es:[41h*4+2]
( E  i  d$ R- C    cmp     cl,al
1 k; P! M6 S1 y) O. t& H, P    jnz     SoftICE_detected
1 a3 ^3 N: k3 C( K& O2 W" z2 J( Y3 |1 w8 k6 r' o5 }
_________________________________________________________________________
, i/ g% |9 i, h6 N* L
0 z5 f, ]  I* o; Q" UMethod 07' N4 |- w1 o8 t
=========$ H, I: _7 h* A* ~- X4 a

0 X* l6 U4 F0 u2 s4 a* nMethod of detection of the WinICE handler in the int68h (V86)
- X' n5 k9 o, H- V3 I
* u! N2 m5 }, j! r    mov     ah,43h
4 |& W  l, ]# c# T8 c% q    int     68h
+ L5 l# R) {$ y/ n! \% {    cmp     ax,0F386h
/ {' G: X! r7 `2 I) _! }" `: X6 |, D    jz      SoftICE_Detected
* c9 \* F- _# F7 Z5 b% E9 o5 j: h0 O

$ W" y! Z' L' U& O=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit1 \- e3 j7 j. R8 U4 N; k( d, i, g
   app like this:
3 w9 V1 w/ C2 x9 M8 T- E% w3 a. ~) f
   BPX exec_int if ax==68
8 `7 R/ D- S. y& T& _   (function called is located at byte ptr [ebp+1Dh] and client eip is: C4 O9 d7 L  @* v
   located at [ebp+48h] for 32Bit apps)
4 [0 l+ W  X+ C4 R- U+ i- s0 W__________________________________________________________________________+ F/ \+ M% K$ S2 r: Q
* J& f% {' B, {/ V! C  r4 [
# @/ S, R/ e4 p
Method 08
% f; p  K8 i9 l! l=========! i+ X0 w6 d9 Y6 e9 f0 W  G. \

* w% i: i/ I9 E% V. TIt is not a method of detection of SoftICE but a possibility to crash the
7 |! _+ y' P9 W5 ~" Rsystem by intercepting int 01h and int 03h and redirecting them to another* F  {4 e1 g& I7 U6 ~
routine.
9 S/ ?2 n- \8 l9 L2 kIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% W& ^9 T" i1 q% ]6 B& s
to the new routine to execute (hangs computer...)' n0 V5 G1 u% O, G( O9 d3 u+ f
* G: S/ l  B( T6 W; j; G
    mov     ah, 25h3 w. b. \1 H6 _
    mov     al, Int_Number (01h or 03h)
# ?$ Q" Y$ D, V' \% G' {    mov     dx, offset New_Int_Routine, {0 j$ P  c; W0 J) f+ I/ ?
    int     21h! w2 }/ z0 O' V! g

7 O4 J1 P8 h1 O4 V0 t# Q__________________________________________________________________________
9 Y  \( G" C  k5 T, Q  G' U* C0 |% M1 S
Method 090 i  H6 ^$ j3 i& T7 y3 Y6 R1 x9 L
=========
$ {) V( m9 t1 O) g3 H$ J
* j) h& |9 R  e6 \  o; k7 |- RThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& q  L6 S, g; X7 N# Q9 bperformed in ring0 (VxD or a ring3 app using the VxdCall).5 o9 Q/ C+ ~/ A5 z) \# i. ?9 ]; \
The Get_DDB service is used to determine whether or not a VxD is installed
6 f- [' T8 D6 n$ jfor the specified device and returns a Device Description Block (in ecx) for2 C% p& |" \  V- u# v! X1 p( C
that device if it is installed.
/ s# F$ W) T' A7 r) F1 W' X4 x; p& u# M& E6 L; d2 ]+ _
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! q1 v! y- ^: a3 b9 z+ m3 H% b: Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" @4 J9 j; X& w3 ^) d   VMMCall Get_DDB
- Y6 ?, F' ?  y6 g   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. v! n& x4 n/ u; F$ d: r
# i/ m  n% x+ _" Q: ?
Note as well that you can easily detect this method with SoftICE:6 E0 Y& f( ]; L: v* X- S: ]
   bpx Get_DDB if ax==0202 || ax==7a5fh1 w" _! i. K' v

& K+ c0 S" c3 x7 K/ r& I5 E- b__________________________________________________________________________% n" n; Z8 E2 T6 M
+ P. W5 F" c" Z* J
Method 10
8 |" g1 U; H* {=========9 r6 ]5 ^7 \# _3 d; @
3 h, Y0 A. X$ Z6 t* M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 Q" Z1 _7 A: B8 [9 ]1 T9 k  SoftICE while the option is enable!!6 S$ e# Q/ t, L0 l, @

# M  q1 \% A, s/ OThis trick is very efficient:; S/ d3 R8 h  A- ^) _
by checking the Debug Registers, you can detect if SoftICE is loaded
+ g* _; a% ~) \' A* z5 Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 \9 s% r- T& F9 ithere are some memory breakpoints set (dr0 to dr3) simply by reading their
' r# g3 t  S  k6 n4 C2 _% vvalue (in ring0 only). Values can be manipulated and or changed as well! M. L2 U! o9 m+ @! a9 O/ k: C, j7 ~
(clearing BPMs for instance)
# k1 U* f& f; h2 ?# l8 D/ L+ q9 d& h0 t2 k8 E" H, N
__________________________________________________________________________7 F+ j; B4 T4 p

7 r  n: V" ~7 w- t7 ~Method 11
% w1 K2 t; C6 u+ `+ W5 [& @, U=========# s0 L( Q8 `& C* L8 M

' `2 ?  e8 R- y: r+ KThis method is most known as 'MeltICE' because it has been freely distributed  ]3 ~" c5 A9 G1 ?4 k, ^: S; }
via www.winfiles.com. However it was first used by NuMega people to allow
! j% U4 Z7 U) j2 g& X% t) q2 r: xSymbol Loader to check if SoftICE was active or not (the code is located
9 q4 v3 l1 z$ Kinside nmtrans.dll).
' N* c2 ~; F; C2 b+ {9 |1 w% ]0 y( A# @7 T" w, a9 u
The way it works is very simple:
+ ?! }+ @5 t  H+ vIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) d% h9 F/ ]2 F/ m+ Z% `WinNT) with the CreateFileA API.
% K) D/ S5 T" `5 [" x7 k! X2 ]( p% a% _- x5 E
Here is a sample (checking for 'SICE'):
$ {$ p/ }, n" {4 P7 h9 D# c& T: r& a" |
BOOL IsSoftIce95Loaded()
6 g3 w/ X. `$ V{
9 b. E" l; Q% X/ G; J   HANDLE hFile;  
; M1 G+ U  }$ h: T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
3 w4 i: y+ ^0 N* H! X% n                      FILE_SHARE_READ | FILE_SHARE_WRITE,% k' ~4 {6 @- C/ C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ g; f3 u2 q4 A9 Y8 Y* T$ G
   if( hFile != INVALID_HANDLE_VALUE )
& A4 \* `2 i6 M+ Y' o9 s+ v: E3 d5 `' K, `. c   {2 S) m, v! K5 G. [5 W5 P
      CloseHandle(hFile);7 v- m4 W, c/ v/ o8 S
      return TRUE;
! @) U; ?" T0 S. q) _9 a0 F   }
. s: j8 ^7 i, v% C; a2 S0 }2 g   return FALSE;, G6 z! u4 {3 L% {' }
}5 E4 Q( }, r9 S) ?
* Z1 z4 h- H# H7 `1 L
Although this trick calls the CreateFileA function, don't even expect to be
. b7 E6 n- p$ Y- ]able to intercept it by installing a IFS hook: it will not work, no way!
1 j7 h2 Y; x' l0 i; l. S, GIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
+ @: g- J9 }; T4 n9 c0 k& |+ T1 mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)4 D+ j8 d# `4 K. T' d. h# }
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 U6 k3 W3 S9 a# [field.  J$ `& F3 K: F/ [4 j% ]
In fact, its purpose is not to load/unload VxDs but only to send a $ D" o# d. K# n- [5 ^  a+ \
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
. Y$ R% F! ~& D9 ?to the VxD Control_Dispatch proc (how the hell a shareware soft could try- ?% _9 o6 b8 [
to load/unload a non-dynamically loadable driver such as SoftICE ;-).; J% X& ]& S* N; K: j2 b# q5 R) K
If the VxD is loaded, it will always clear eax and the Carry flag to allow& q* a, e: ?7 e5 D
its handle to be opened and then, will be detected.7 _, y) Y% q" U2 Z
You can check that simply by hooking Winice.exe control proc entry point
% u+ h% I, G7 k% d! ywhile running MeltICE.2 s/ j  K0 B3 W% }" f5 d) k
7 u! x( y' j1 ?5 B5 d

6 ^" [2 H- y9 A7 l+ W0 \  00401067:  push      00402025    ; \\.\SICE2 T5 R; x8 M$ m. S7 g
  0040106C:  call      CreateFileA
9 @, S0 L; p8 y1 j+ R( E# \  00401071:  cmp       eax,-001
7 |& @! M1 A3 g/ k: g5 k5 b" e5 c$ s5 K  00401074:  je        00401091
" c' T4 F& J/ L/ O# J! V- e: i8 ^- J& [
! W7 G7 I/ \6 z* U0 j; N! x5 [7 H5 n5 b
There could be hundreds of BPX you could use to detect this trick.) Q% @) U1 B9 `, U
-The most classical one is:
' S# |" V: D! w% }( L& O) ^  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||% h1 ]- J4 Q9 D% p8 W/ x! O9 F
    *(esp-&gt;4+4)=='NTIC'0 l  E! a3 b5 C+ Q! \* Q: h% Y0 c) _) D
: H# O3 ?; k3 L3 V( O/ }
-The most exotic ones (could be very slooooow :-(
+ q( }2 P2 \+ o: B3 z  Y- W   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 a5 }0 {: X% O* o! S
     ;will break 3 times :-(
9 L1 z, L, A/ e# I6 _4 p6 ]% v  m, j, T
-or (a bit) faster:
1 _7 e- a+ ]7 l9 N( Z  B6 z   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
  K( p' X: H5 L1 V# C) \0 f
8 y/ z+ {2 c' Y( d   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
* ?% j7 f( P/ J' }     ;will break 3 times :-(
/ h# w* K6 p, }0 D! @( P3 h+ f
5 p" }' X% C/ @& K2 L- w: [: C-Much faster:
) N( V' S* i6 i' G   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% T% p6 G& Q- h( Y$ ^4 w0 s5 {6 {5 k  c  R" {( [8 v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* |8 W1 p6 N& N# Z# Vfunction to do the same job:
  W1 s* P) M# S2 p9 Z0 z7 U8 K4 q( G/ s4 f1 S
   push    00                        ; OF_READ/ D9 o) N& ]' ^2 e. A$ u' @
   mov     eax,[00656634]            ; '\\.\SICE',0
* P7 s+ j) u2 |   push    eax1 b! |* K: s; a
   call    KERNEL32!_lopen5 o% j7 D9 U1 M, G$ h
   inc     eax6 ^" O1 G9 k+ [& ?
   jnz     00650589                  ; detected6 M  C- W' {3 P4 J/ s  @( J; w
   push    00                        ; OF_READ
! `" F8 R3 F1 j, V% E   mov     eax,[00656638]            ; '\\.\SICE'3 Y* r  i* e: Y* X& b
   push    eax
. d2 A. ~8 N9 G   call    KERNEL32!_lopen
% E& H0 ^8 ]5 Y% X0 M1 |   inc     eax. K* M6 a9 ~+ `& m  x
   jz      006505ae                  ; not detected
7 X( h' g2 c. F; _& B  l$ l- j) P' _2 j

$ g9 L8 a4 h7 R! p) u__________________________________________________________________________
+ `2 G- v! v4 s/ ^3 u" W0 k& S
5 t; {/ F6 g$ O2 h5 B) s6 p) h* M5 ZMethod 12
- ~# C8 X. s, V( k2 `=========: j) K+ k" N* F, j0 t
- h6 v: z% p* G- I7 y- s. A! a
This trick is similar to int41h/4fh Debugger installation check (code 05* P8 D5 i/ T: v+ q, ^. M
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# I; P' Z& T9 w1 h+ ]as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
: M4 y$ `. D  Y; t" h# H. {5 F. E
   push  0000004fh         ; function 4fh
8 K$ `* i% P. y   push  002a002ah         ; high word specifies which VxD (VWIN32)3 F% b0 q7 L  ^( J( q
                           ; low word specifies which service9 b6 f9 _& A) V' C1 J- ?6 u0 K
                             (VWIN32_Int41Dispatch)
$ l; M7 b- p$ e2 s$ q3 h   call  Kernel32!ORD_001  ; VxdCall' Q% B$ W3 H0 b; X
   cmp   ax, 0f386h        ; magic number returned by system debuggers
. z* |% N5 J( ^; f   jz    SoftICE_detected
+ \# `! I" X  P
, q9 l9 ?) L( R9 K6 `9 d; UHere again, several ways to detect it:
$ N$ ]3 Q( f4 q$ X* }* ^( `* H- [! Q7 A
) L9 J/ p1 G2 i2 |7 }3 t: O4 U% l    BPINT 41 if ax==4f
+ c6 X2 z5 r& ]& K
# n1 j  t0 w/ e  F3 y4 D  m; U+ G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 w6 f. q* |, ~. m, \! Q1 R

  y4 A/ |! e0 n- J% u  Q- ]' ^$ ^    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* M" l! M- r4 Q4 p7 F0 E6 S( l$ b+ X, u7 w0 {! S* n. P
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' L. k8 \. q1 h; e

5 Z: M4 j& V- v$ b3 W__________________________________________________________________________
' D3 ?% m! ^0 L6 x7 U
6 Q, X5 A/ k& }. |Method 13. m$ D* m+ Q4 Y- W  ~: K
=========
3 Y' H3 B0 M7 t( n8 Q. c
( H. D! H7 m9 `. u: o6 XNot a real method of detection, but a good way to know if SoftICE is
2 z& ^! m7 s* d  l! ]8 kinstalled on a computer and to locate its installation directory./ l% t5 X6 X" |
It is used by few softs which access the following registry keys (usually #2) :; N7 U' @( d- X# e7 K/ H
# H! q0 X: g; k: E2 E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  S7 E3 b8 M; s0 \' f
\Uninstall\SoftICE
$ ^+ E& P2 i5 S2 y4 L  v-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ t$ B, u( c( u9 d  j& M. t-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 Y0 A9 V( C6 E: P# K1 h% w\App Paths\Loader32.Exe, z& h" Q0 s3 d# N) [
: J# O2 ]0 |( b/ X: e' I
* N  }* @2 M6 U: d  Y
Note that some nasty apps could then erase all files from SoftICE directory( `3 S8 v6 a1 y1 _- r+ w# o. x
(I faced that once :-(6 j/ k2 w+ S& t: Q7 u

% E" W- d( I# e8 w) \9 y0 }Useful breakpoint to detect it:5 k# \+ F6 f$ D1 ?; t& d

2 }" n" [% J% w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 z1 w+ k$ ^' v1 Y+ l. o' ~

, @5 Y$ D/ h+ B. z9 V) `5 U2 j__________________________________________________________________________
# U' k! R: W. @2 X) S2 c, W% U+ \  i  s
% Q1 f- j4 P. X; N# l6 E4 f
Method 14
" X+ B# Z& Q3 g2 P3 t; f1 Q8 N=========% x% s$ e- ^6 G5 M, r! \) J$ y* }, k. K

, N& l3 U- R" h. T. FA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 _; A) K; G8 Y: N+ [9 P; V" bis to determines whether a debugger is running on your system (ring0 only).6 F$ u) ~4 n# i% K
* K8 ?9 Z. A$ S9 `  Y7 o8 p
   VMMCall Test_Debug_Installed1 G& d( O- k6 K2 [; g
   je      not_installed
8 X' d4 _. }% N3 I( j9 u: h. U& r0 c2 g* D
This service just checks a flag.' d# j8 v9 X0 \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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