About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 f! M2 X9 G' n" b$ m
<TBODY>3 q9 |5 A7 k: `' f( o
<TR>0 f$ A- u4 b+ z+ P
<TD><PRE>Method 01 . o' }) a1 W! _
=========
& J* c- y% V4 R) A. r4 R
* W" N: b( e: fThis method of detection of SoftICE (as well as the following one) is
" }9 y2 O" _0 G, o& Cused by the majority of packers/encryptors found on Internet.2 _3 a) F2 l4 J3 c: J! M  m
It seeks the signature of BoundsChecker in SoftICE& o4 e+ l* n6 V4 t

5 i5 N! h  K5 f2 f1 _8 i# p5 n/ p. z    mov     ebp, 04243484Bh        ; 'BCHK'& G8 i5 B6 \0 m) A0 X. W
    mov     ax, 04h# N3 S- K% x' [4 V
    int     3       ! Z$ O1 W* I! P6 y0 V/ ~- s
    cmp     al,41 {' M! R8 p, f& k+ H4 M
    jnz     SoftICE_Detected9 A, I6 A2 z' R# A7 l( c, h

& d1 M( I6 f8 A; b3 W3 ~___________________________________________________________________________
# ]9 Y: z& a7 C4 @" Y0 v% s3 {: v1 Z4 @8 ~  i: g9 x$ k" I
Method 02
- k7 u3 H7 U! F- U& }$ p* i=========$ y6 ?! H4 O9 F6 Y
/ V0 O$ K/ R  H+ r. m8 k4 Z
Still a method very much used (perhaps the most frequent one).  It is used- u% ^9 G  X; E0 p& u- L: |4 M& V$ `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,/ G7 }9 c  S: X
or execute SoftICE commands...
! s" Z6 j! [% O8 d6 S5 zIt is also used to crash SoftICE and to force it to execute any commands; P5 o" Z) Q( q
(HBOOT...) :-((  
& Z2 H2 E. A5 L# a# y7 ]1 F: h8 A7 k1 v
Here is a quick description:1 H: M3 v% M/ N. T
-AX = 0910h   (Display string in SIce windows)7 x+ ^3 U7 f2 h4 n/ f  C
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! w! c) e0 i) X( Y0 y) f-AX = 0912h   (Get breakpoint infos)6 P2 ]- w9 z  \
-AX = 0913h   (Set Sice breakpoints)
/ V# r0 `2 g0 i; v9 g6 Q! s  ^-AX = 0914h   (Remove SIce breakoints)7 w- q+ B% N) Q7 m
* G+ z5 W% B! C7 `% W& E2 X
Each time you'll meet this trick, you'll see:1 x0 F- M# v0 J; T$ ~) Z. E
-SI = 4647h" m5 T0 l( z) \' ?" i
-DI = 4A4Dh
5 y' S: M: q; ?1 r& _$ sWhich are the 'magic values' used by SoftIce.
- w; y" r; ~2 h0 v& e6 YFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.1 u) w& A. Y) f3 k8 k3 e0 J

% ^& `/ S3 _' p, t1 g# t" fHere is one example from the file "Haspinst.exe" which is the dongle HASP
& \! F- L' y5 d0 ~) h2 \Envelope utility use to protect DOS applications:
, n( h, c: v- l
) A( {: }, a; V- P0 I4 y- f* P1 o/ J: V
4C19:0095   MOV    AX,0911  ; execute command.) ^8 ]; Z& h' }
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ W  |; t( s! s3 t0 Z( c
4C19:009A   MOV    SI,4647  ; 1st magic value.
  ]/ w5 U* {7 y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) N' X4 f4 p/ \) ?, a8 @  `3 C9 z6 }4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) w/ J: G0 L5 Y/ Y2 }0 W4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute$ B: _. F) E: w* @
4C19:00A4   INC    CX" H# }( ?4 ~  `1 K% c7 A- l+ O% h
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 e" J+ e' W( y) l" q4 m4C19:00A8   JB     0095     ; 6 different commands.
% x, [, j5 ^+ U2 Q2 K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 J5 o: b5 @' e% P% s& U4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ I. i' q) m8 ~  g6 [' U; m% W+ S' ?1 L0 E2 s
The program will execute 6 different SIce commands located at ds:dx, which
; X; {$ t2 u$ Ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  C6 y, S2 J* }0 u1 c, E! F# b* R; _' z" ?* i5 A. d4 v
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
: k0 @" O% C# D! z) B___________________________________________________________________________
; a+ E7 h( @5 n0 Z: F, t- [
5 K# z, L1 d0 t% n4 u
( D( [/ B2 K" M, A$ Y2 K4 `4 @Method 03
" |7 R/ A4 B. S=========, t$ M) m4 d9 L* W' ]" C$ t

1 p( x% Y5 x0 p# q8 o4 _1 jLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( i, }% l% T; ^1 F2 R, ^(API Get entry point), @* J% }% v1 m
        
; Z  C8 K4 Z/ _8 F0 V
  w$ B4 v" P8 R- e    xor     di,di. R+ D+ r* w% \% _
    mov     es,di
4 K# W% ?# g5 D( T1 U9 t    mov     ax, 1684h       % I+ ~2 Q8 J! ~8 f
    mov     bx, 0202h       ; VxD ID of winice
) w$ @, r% Z( W% Q+ J8 I    int     2Fh
! s8 d' e% b0 y0 V9 w    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 ^9 z- n. `( |  B' }
    add     ax, di
9 @! }% L: i, R! \! P    test    ax,ax
- ~+ l- c6 `. y" m! H$ }/ H: v0 @' S    jnz     SoftICE_Detected. ]8 v/ H; Y$ o' o! B
0 p& E( D! u# P) `$ Z7 R$ A
___________________________________________________________________________
4 D/ I) c( K* ~- Z( T) Y3 y# l& i* ]) y- V
Method 04/ e) ?. o# m$ C
=========
4 j% E* _/ ?+ c* F
0 b; \1 V  u/ b, @/ _Method identical to the preceding one except that it seeks the ID of SoftICE
+ P0 {; o/ ~7 r9 t% j2 l" \7 @& GGFX VxD.
  A0 e- n" P8 E! d4 Y% f: f% G' N
    xor     di,di
0 A& \( @3 H' W7 u( D/ t+ J    mov     es,di4 ~- E. g! @" r0 U4 N
    mov     ax, 1684h      
( y  ~5 V; {5 p+ q    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 q0 n2 }2 {  R% [$ i+ T    int     2fh' X1 P. m& o9 G7 l3 @# z! {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  {6 ]* B1 U- r: G    add     ax, di
, u- f0 Q) N  w! C    test    ax,ax' ?. U3 J* U+ B& T8 m+ [$ d) Y( }% \
    jnz     SoftICE_Detected
2 v) G3 y$ z8 X1 F' M
1 m) P- W" K$ \1 X5 k. g__________________________________________________________________________
( |1 D7 ]& d* m8 s# [) \6 i9 t1 \5 M# g. G

! f: {7 I, p* OMethod 05
. y# N3 J7 ]5 d& @; E! X=========
( X. x9 G) d0 a8 k; h, N& [
4 s' Y, L  E# `+ E3 L9 v# v# BMethod seeking the 'magic number' 0F386h returned (in ax) by all system
. k: Z  C8 u$ d4 J3 e8 I9 Cdebugger. It calls the int 41h, function 4Fh.4 O0 U; i6 d  v6 ]
There are several alternatives.  
5 o. k. t9 [) @4 C# p" G
6 O, W1 d/ }: T1 x% Q9 U+ s; hThe following one is the simplest:
* n9 N8 y- f9 u, F" L5 E1 i3 C2 h" o7 U8 j# U, R
    mov     ax,4fh! {/ j6 v1 {9 ?- m
    int     41h
  n* M0 F) e; v$ ?    cmp     ax, 0F386
" \4 E/ r  l8 U8 w7 ~    jz      SoftICE_detected
) I8 W1 L  I0 w" u4 h
3 |6 E) i% P9 c6 I# L. z2 s# l" G. \) `# @3 M* u
Next method as well as the following one are 2 examples from Stone's % @8 M" ~- R; ~& s* h2 g
"stn-wid.zip" (www.cracking.net):
$ b) {6 E6 Z. g( n5 A% W4 d9 }, q6 t- @2 j. l
    mov     bx, cs5 n$ q) m2 T2 {- `! B$ K6 S
    lea     dx, int41handler2* ]# i# u( i1 F' |  K) G( C1 g
    xchg    dx, es:[41h*4]$ b9 K: p2 ]4 H- ^, T$ Z
    xchg    bx, es:[41h*4+2]# k8 E; ^  R9 p* G9 a' K
    mov     ax,4fh
! `8 t, f+ C7 N    int     41h
3 F% P+ @3 U; I; p9 F7 n5 a% D7 ?    xchg    dx, es:[41h*4]
6 Y; o7 Z7 B* W1 ?4 q    xchg    bx, es:[41h*4+2]4 {3 n2 M, c+ a$ w! H) c
    cmp     ax, 0f386h: A3 k2 T* o6 w9 a% M
    jz      SoftICE_detected  x- X- x7 p/ ]; c/ }: U* \

. e! V6 e7 W# t% z8 xint41handler2 PROC
- Z& w+ I7 ~) E# A8 k! C2 E5 i    iret- E3 l% E1 f. k
int41handler2 ENDP
1 ?! n/ R& M" Q% w$ S5 X, M( s- V* [2 ^. v3 ~% G5 e9 Q3 V
6 k! c8 D  B) o% i0 L1 H8 u
_________________________________________________________________________* F5 s; E, h( b8 F+ x" G$ H5 e
% V& r* V( r: p8 g$ W8 l

* ~% R4 X4 p2 ]2 ?9 l+ U( WMethod 06! w7 E1 r+ r0 W' Y! U6 ]: h7 n6 @
=========- D8 w% s9 T0 V. s

7 s% S8 g; b7 x4 S, w( G* Y8 ]' J7 @
7 B8 S( S% s7 j2 k4 r3 `2nd method similar to the preceding one but more difficult to detect:
% i. H, O0 S) X& b! V
/ u+ U# |5 q. p
4 d1 k6 m& w; N  E( {0 v" R% _int41handler PROC- Z) g- `/ l" `- E; n
    mov     cl,al
, o3 G. i  S  ~* Y+ @    iret8 Q# l" [( H' y
int41handler ENDP6 t, R. K1 @( D% W% C3 M! o* k

1 C" c6 x4 I6 y, r8 W$ U
0 V  {& n9 t, v5 o0 E9 D    xor     ax,ax4 D- I: r5 C! {5 N4 m
    mov     es,ax
% j" f: k( `( o/ S    mov     bx, cs+ G) n' i# u# ~  ^; N
    lea     dx, int41handler
- x! y: V' G; W1 o    xchg    dx, es:[41h*4]4 N: T9 `  S# B
    xchg    bx, es:[41h*4+2]. V2 e, A( A1 F' \) a5 T; Q$ J
    in      al, 40h) P. a! _2 E! O& S& X( ~
    xor     cx,cx, x) X8 G$ Y! d7 c
    int     41h, M/ a, U6 w7 Y
    xchg    dx, es:[41h*4]
1 J6 ?% f9 H' L1 _    xchg    bx, es:[41h*4+2]0 T/ F" U) y! \  K6 P
    cmp     cl,al
2 O+ _: H- X5 w* n9 K( ?8 o    jnz     SoftICE_detected
+ A" W& ~( L% l" X
, P: h0 q6 g# P( h_________________________________________________________________________2 ~3 ^6 k. m# \1 c; z
7 y7 A* K8 h9 C4 Q) q  E' F' g% g
Method 07
) Z8 b6 M% m; K/ e( Z9 h=========
1 E; ^- G2 Y3 C
1 O  |- a6 M3 X1 xMethod of detection of the WinICE handler in the int68h (V86)" c. U" O6 a! D& A. e
& J6 N0 n* c3 S( f3 `
    mov     ah,43h, x9 R' d/ s( m/ |, u3 ]+ u
    int     68h, p' k, j: Z1 A' o
    cmp     ax,0F386h
4 c* I8 }. i% z. Y* B( O" J1 d! S    jz      SoftICE_Detected; O7 r% m& h( m1 \" B

1 r. U1 |- |* c/ o% h8 f. @# U: ]3 [" C( T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit# x3 ^' O8 B5 k( O8 q
   app like this:& H: c5 }6 A" P; ]* i5 q
0 U/ K+ _+ {0 P7 Z3 o0 ~
   BPX exec_int if ax==68
* Q; |$ v! X) F7 l; l) N% i+ |" K2 N/ \   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 ~$ Z. O. a: h   located at [ebp+48h] for 32Bit apps). E( P' m* H9 q) v  k8 h3 \9 d- Q
__________________________________________________________________________
. ?6 l* u* y4 [* ]8 a+ A
- h( S" N7 {0 _4 f" ^% o+ l* S( ]0 i2 _/ }8 k$ b+ B. h
Method 08+ L% _8 _8 V, h# e% e& P
=========
# c9 m: w! G# G, X8 X
8 q* H1 n( I; p) |/ uIt is not a method of detection of SoftICE but a possibility to crash the1 _2 c7 F. ?7 e1 G: A6 L
system by intercepting int 01h and int 03h and redirecting them to another" ~& A, R6 }/ n% T0 \. v  l
routine.
9 s( H* |8 t# r0 v" q! C2 HIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; Q+ m+ [" j) g6 m- f8 A
to the new routine to execute (hangs computer...)
  Y7 k  Q$ Z( e, Q- z
1 Q" w( M9 e6 l: Y0 A    mov     ah, 25h, p# c2 Q$ {" Y8 M: ]' {7 E# X4 h/ Y
    mov     al, Int_Number (01h or 03h)6 `7 g0 f' ~9 J6 a( w5 V' ?
    mov     dx, offset New_Int_Routine# _% H" o1 i, I& v
    int     21h
" N- `# ?+ u% x6 j) N$ ?# B) v5 k' e. T0 \; ?) d
__________________________________________________________________________  W& W6 ~, b: k- }0 D$ T
0 C2 o2 I9 ]- `. A9 L* O
Method 09
+ f' D3 j; n, i! B3 k" m8 F=========
  k( L3 F  }! A2 B% i
5 d, e+ |1 A7 xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only! X3 J9 G: j' C7 P( Q: z1 n. a) X
performed in ring0 (VxD or a ring3 app using the VxdCall).# N/ T3 Z8 k! P8 n( {- Z+ d
The Get_DDB service is used to determine whether or not a VxD is installed$ ^4 Q- w- k3 j2 _6 r* _1 _3 {- N
for the specified device and returns a Device Description Block (in ecx) for6 i$ r$ K' t1 v; l. m
that device if it is installed.' \9 U7 G- R* Q; W5 Q0 P8 n. U: x
: w# `, ]" v) }" R; L8 a% {
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ T) z1 X% q( C5 ~5 h   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)1 a: A( u1 v2 A, B  @
   VMMCall Get_DDB
* l( I' |( B# b2 Q6 a   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 v! j. M6 @( T& m  E5 H# U/ ~3 r

9 T' S9 E  x. j" G9 k: |Note as well that you can easily detect this method with SoftICE:
% m, J% K$ U! h* O) b   bpx Get_DDB if ax==0202 || ax==7a5fh
! `4 `5 b8 l1 Y2 O" z+ p' ?: J/ l1 C1 Z6 q
__________________________________________________________________________
5 V7 {3 o# L9 Z+ n3 s! y0 h( T
; T; d' W/ c% M# L, bMethod 10+ a* ?& D! I; e; L  e( c
=========% \5 c+ c+ [. d: T  p' }# }8 D5 X

; i) V3 x7 z5 A: W7 C$ ^& ?  P=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" ~5 b- a+ F3 ]/ V
  SoftICE while the option is enable!!8 l5 Q+ W  U. l  ?
9 @* Q- O7 D( K5 o: M, f
This trick is very efficient:
6 j! o$ Y: c5 p* W7 [, M+ Z" Oby checking the Debug Registers, you can detect if SoftICE is loaded
; B/ b' e4 t+ L4 _8 T8 x( V. x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 I7 Q1 e) s4 ?- t, B+ a+ O
there are some memory breakpoints set (dr0 to dr3) simply by reading their: o, s  M* E. q/ W8 P5 W
value (in ring0 only). Values can be manipulated and or changed as well4 u- P4 |: I8 Z: n% w
(clearing BPMs for instance)5 e  K6 u4 t9 i5 G$ u9 `
" Z7 `- s. l7 l7 T" z1 Q
__________________________________________________________________________
: i  y6 d0 c! q+ Q  L
1 z+ Y/ b/ Z3 U6 g3 rMethod 111 [' [. \  A( e2 R7 U
=========
  x: X4 [/ K, {5 a$ T  I( u1 h
2 ^6 g9 {; C. pThis method is most known as 'MeltICE' because it has been freely distributed+ t2 l  @; }4 ]( I* i
via www.winfiles.com. However it was first used by NuMega people to allow
* R8 c; Y7 o0 m& pSymbol Loader to check if SoftICE was active or not (the code is located
' U5 C% A+ T1 f: k$ J4 j% yinside nmtrans.dll).
3 O  u) f9 |/ D9 s; {5 ^$ G) o
1 Y* ]2 n" ^- {: \3 QThe way it works is very simple:
! H0 |  `- T9 I+ Q9 Y5 T! H8 P2 J/ CIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for. n& \( j  N: Q& X5 i/ h1 @9 F
WinNT) with the CreateFileA API.
4 A, k  |8 `8 J2 j9 x3 R7 ^' Q( d- U$ g0 k) h, U- _
Here is a sample (checking for 'SICE'):
' {1 t3 I1 I) V9 o4 p  G6 `+ V0 Z1 ]
BOOL IsSoftIce95Loaded(), d2 O" e, j- c3 Q4 p3 R
{
$ I+ s/ b) j  v: Y" b9 S( m   HANDLE hFile;  + n; l# w  |& m# L
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
$ Z+ i  I% E/ m% {( ^" X                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 R( O+ y! S  w5 L. j6 N4 J- l( ]% s                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 Q( R6 l: q/ h   if( hFile != INVALID_HANDLE_VALUE )
; t# Y# @3 |& N7 P( h   {
* J5 Y2 ]9 ~' c4 {      CloseHandle(hFile);& S6 `& _5 ?# n  j; w
      return TRUE;* T4 Q( Q1 z4 ]7 k0 Y
   }+ A  t" Q# g1 G
   return FALSE;: m7 f0 [5 W2 F; y# h: N- x
}
) B3 w8 Z6 ~, m2 G( o4 Z% K& g( W' C4 ?" {4 L+ L) W: l3 `$ }
Although this trick calls the CreateFileA function, don't even expect to be  A) j6 L8 S' P+ E) S) c5 d
able to intercept it by installing a IFS hook: it will not work, no way!; L  |* C5 M( x) D6 D
In fact, after the call to CreateFileA it will get through VWIN32 0x001F+ `3 j; c: p. x$ q0 m' ~5 g% E  _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
# f7 A5 j8 V2 y, L  H! Sand then browse the DDB list until it find the VxD and its DDB_Control_Proc- K$ |1 e1 c" K4 C( r
field.) {. h* v: c: |$ q" w  _
In fact, its purpose is not to load/unload VxDs but only to send a
; `) U% L5 q  N% t+ `W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, M  ?; ?8 I- m* L: \to the VxD Control_Dispatch proc (how the hell a shareware soft could try
. I) _2 y7 n) ]! cto load/unload a non-dynamically loadable driver such as SoftICE ;-).2 _, f' ?/ v5 H/ L' }
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 A- g; s* P' u
its handle to be opened and then, will be detected.
* u9 P' D2 ^. g' D# ]You can check that simply by hooking Winice.exe control proc entry point' y3 W+ Z  [0 j! r9 b! q
while running MeltICE.% G6 u$ ]& ?7 m0 m) V! N' s
& B- U) |' ?$ B0 f7 c* d

5 m+ q: _7 N3 }8 }5 F% t5 D  00401067:  push      00402025    ; \\.\SICE8 T6 v1 j7 m6 u* C! L
  0040106C:  call      CreateFileA
: b% g& i5 P, H+ ?7 D  00401071:  cmp       eax,-001& n* `+ a5 K0 a5 {& O7 [. O2 C$ ~& w) ~  e
  00401074:  je        00401091
6 ~& s( n6 b: V4 }; r5 A/ ?7 v+ y% |& ?  z* T, P7 L! a2 [
$ A) c% T9 W/ x/ L* O
There could be hundreds of BPX you could use to detect this trick.  F# O" R! f0 o4 o
-The most classical one is:. r  C. s+ {$ l) G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) {: s" c2 I% n. M
    *(esp-&gt;4+4)=='NTIC'
$ W8 h- r2 b, Z; S, x5 A0 q6 l: S. z6 k: h
-The most exotic ones (could be very slooooow :-(
. z3 _& y+ r5 I2 Z   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  3 i7 f6 D0 h, B  B" c" k
     ;will break 3 times :-(
- \, M6 t/ e- i+ u) {( W! s
4 L- ~- O3 h/ s/ r-or (a bit) faster:
  d9 b- c$ v( p* {7 P! V   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' V( t, f0 F1 S. x# M
  H/ I  p3 D# A  L8 l3 o   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 r$ ?5 X4 q/ [4 ]5 V# a7 s, W; y' Y     ;will break 3 times :-(
5 Y, `# F9 z  q& D3 _5 E9 C  x( v4 {
8 l9 M7 C% M& B! A" g-Much faster:
1 s4 x# T# U: S3 ]9 K2 N/ ~# F$ E   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', P" M& c- {( U+ E1 @
0 |, _  Y# D/ v! S+ b
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen0 @) ~) {0 `! o" j9 X
function to do the same job:0 \3 K# W# ~; b+ z- w8 B& r

0 g/ F. ]- l7 A   push    00                        ; OF_READ- U3 x- H% K0 g
   mov     eax,[00656634]            ; '\\.\SICE',0
+ j6 u/ `# r, m9 ]) ~8 L# h; O   push    eax! r! l0 \0 S3 B$ o4 b' Y6 e0 S9 r
   call    KERNEL32!_lopen, R! i0 A, W8 ]. Y0 ^
   inc     eax9 P& J2 H1 j& o! b6 |$ J
   jnz     00650589                  ; detected
: a* i$ I) X7 h6 @+ e) {   push    00                        ; OF_READ
/ @2 X1 L' _# t4 t   mov     eax,[00656638]            ; '\\.\SICE'
7 |9 g  t  v0 m& q$ i7 n   push    eax
, B; p) h( N  H4 z, V   call    KERNEL32!_lopen
% b  ^- m5 p- o9 _# W* d   inc     eax0 I+ p/ L7 S/ M0 l. D- n
   jz      006505ae                  ; not detected
- `$ F! V- y1 r- ]
% T! g, T* D* O3 }  x9 v- f8 o. f5 L0 l, p. }
__________________________________________________________________________
$ m( l  p! A* p  _: X6 b+ H# ~/ s' ~+ a
Method 12; x/ z$ C+ z$ ~  F( s/ y' Y9 B1 e3 e
=========
* h0 i- v( W* z) i" i5 m/ @. |; Z# I5 A' ~) Q9 e1 A1 J
This trick is similar to int41h/4fh Debugger installation check (code 05
6 }: w- I4 v5 M&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 ]) T5 _3 M! Y/ W% |( h
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% j9 j, V4 S* I* J' q: `# `/ w6 b$ J

+ V: q9 ]% L- c* \4 S) D   push  0000004fh         ; function 4fh6 {& O5 m' z0 C5 P8 s$ K! C' t
   push  002a002ah         ; high word specifies which VxD (VWIN32)! J. K9 }; s, r( w  N" n2 f, R
                           ; low word specifies which service
/ C! z3 M+ f* o) e% i                             (VWIN32_Int41Dispatch); {( [( c: D9 i& x% W  U, _
   call  Kernel32!ORD_001  ; VxdCall! P2 m0 j" l1 r) z6 X7 H: K
   cmp   ax, 0f386h        ; magic number returned by system debuggers
5 `( l4 y2 ]( c: D6 T" L* _   jz    SoftICE_detected
! P4 b1 a; ~& b
$ e4 i6 ]. t  s  xHere again, several ways to detect it:; |1 t. w. c' |
! a2 s( r6 k  E. _* W  K
    BPINT 41 if ax==4f
8 ?6 l+ |) H4 e" M, w# i8 o9 @  i( @. @; L
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 q# ~' N/ [8 N- g
9 Z5 P8 r4 I( N) M/ Q6 A    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
0 @+ r# M8 c4 r% \  U+ y
7 r  Y; A3 M) ~* R& ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) a4 q" E8 B3 p4 i9 m+ `- l# r- k

) ?. ^2 U& W! k, ~# S) n) t9 K1 l__________________________________________________________________________
0 H- o- T. c+ E7 o1 _+ w5 t' q4 X  d
; l6 f1 Z0 Z$ }$ ~Method 13
& d3 o7 _7 U& s+ J4 @. t# b' [8 j$ s=========, c1 |! S; j3 p( D" y3 H

# d* q) C4 C; E) Y9 d. @Not a real method of detection, but a good way to know if SoftICE is3 O8 G. B, b' R4 Q( q, T0 \  e
installed on a computer and to locate its installation directory.
. R; O0 T: F5 W( }  u6 f0 ^, U) rIt is used by few softs which access the following registry keys (usually #2) :& A( M% C+ h- Z' q7 b9 g
. I1 q2 `; c  y9 Y; `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& J- W+ h# Z/ L) ]! t- I) ^( s
\Uninstall\SoftICE/ N9 V% d$ l$ C* T! g+ G
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
* ]! W, d* i, D1 N9 Y- i; p1 M+ P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 y# F, @0 b; O5 M% v! u\App Paths\Loader32.Exe
1 X: ~1 d4 B' o$ o, m$ u3 L) l$ e. L/ z, K

' m# K% W& c8 w$ `Note that some nasty apps could then erase all files from SoftICE directory$ a+ A. b5 T3 G' _6 L( k
(I faced that once :-(3 g3 ?6 `6 W% H% z$ ?: V: \' ?

/ t) P- I, ]4 Y+ x5 D- U4 gUseful breakpoint to detect it:
# F; J3 C0 n, @% [
1 j6 P- A1 V0 L. m+ \     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  F6 l3 w9 i# S5 ~2 Q* |5 j$ R4 L1 N4 ^$ l& k! f- ?1 M
__________________________________________________________________________
3 u8 c- E0 v$ s# K/ D1 y  v1 y1 K  Q8 R* [
5 z: s' Z3 d( v3 \( j% A* @  ^) Q
Method 14
# o6 M( z' z5 D% T, V2 m2 @=========
3 k0 a9 C& l0 W/ H# W9 }, @  P) B1 `- |1 m9 ?. ~
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) B  u9 M+ m! S1 D0 r" D0 F* x
is to determines whether a debugger is running on your system (ring0 only).% a+ l/ |6 J  L% T3 c
0 ]6 k8 J; h! J3 g: [# I, O: e
   VMMCall Test_Debug_Installed+ s* p! M6 e: o+ P
   je      not_installed
$ |! `1 v2 _) Q. f8 J( I4 a# e* K8 B% i7 B: Q7 w
This service just checks a flag.6 G7 z6 \. O$ h& N6 w+ ^$ b3 W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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