About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. \" A+ d: V5 b. S" Y
<TBODY>* Y5 I( k0 G! K' k
<TR>8 s4 a  _& F! n% ]8 P8 V# ~+ E
<TD><PRE>Method 01 4 t$ l% E4 @- F) |" X0 i) L
=========% O: ]9 J$ |0 R1 i( J% U1 R

1 i4 o2 b( W7 a/ v) r. j( q0 k3 p6 MThis method of detection of SoftICE (as well as the following one) is% Y" F8 A' c+ ]  v5 `, j
used by the majority of packers/encryptors found on Internet.! O/ n4 Q, P) U
It seeks the signature of BoundsChecker in SoftICE
+ z( t8 K- I/ Q) `* C3 w) v0 s+ h9 K" |2 E5 M# z. U$ U6 g' F1 T
    mov     ebp, 04243484Bh        ; 'BCHK'& p& I+ E# S) r, Y
    mov     ax, 04h! F2 v: x+ B$ P# {" F
    int     3      
" o+ c2 \: W, s+ _: E7 u    cmp     al,4
% |5 p+ d- O& A5 c    jnz     SoftICE_Detected
( U3 ?; K/ F) F/ z) F. t, g8 [% B: ^
___________________________________________________________________________8 N) z. X( k, y) e$ }! l
8 n5 d( J2 P7 y: j3 A
Method 02  ~5 F# i7 B) _, R+ w- {
=========
, i, S; f# k" s# [* i$ F, |8 k
5 f$ k" ^$ ?" R9 |# A: Q; }Still a method very much used (perhaps the most frequent one).  It is used# d' l! g4 E% P+ _8 ~$ j
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,( X: f1 c/ D1 F6 k! G5 ]" k
or execute SoftICE commands...
; J7 o/ V/ S/ I& q$ rIt is also used to crash SoftICE and to force it to execute any commands$ J1 y9 s# W3 {( X9 ?: B- q
(HBOOT...) :-((  
% q. E* X& N6 E' Q1 B4 o$ H
1 G  M( s) Y: b8 `2 N6 kHere is a quick description:
; ^. U% u' ?, L-AX = 0910h   (Display string in SIce windows)
  g  U1 v9 H2 r+ T+ P  C-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
1 A" l) ?2 K0 H$ u% {3 f# p-AX = 0912h   (Get breakpoint infos)/ }0 z0 m/ m' t( E, l
-AX = 0913h   (Set Sice breakpoints)
" i1 q" q4 o& g4 ~-AX = 0914h   (Remove SIce breakoints)
* g  [2 A6 U9 ^" V1 I9 c+ O" Z. H7 A  q7 V( m* t
Each time you'll meet this trick, you'll see:9 b9 u5 p9 H8 k) ~2 z
-SI = 4647h+ M$ }5 L9 g, m. i5 _, j3 R
-DI = 4A4Dh- ^+ ?' p. f1 C; c. s
Which are the 'magic values' used by SoftIce.- I. Q, j5 q8 I
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 y- K6 E1 Y( k
- w$ Q' `3 }7 V
Here is one example from the file "Haspinst.exe" which is the dongle HASP' W3 l' k' R' x# ^2 z
Envelope utility use to protect DOS applications:. W! _1 u2 F/ }6 \& \9 }2 B

* d9 |* g% D! c6 s7 x) B, s" q/ B* D0 F
4C19:0095   MOV    AX,0911  ; execute command.
8 E) A. W% V, q) B3 c; P6 o4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: L% J/ t( ]+ r+ K" [/ D
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 {; A/ g; g3 s6 _; o4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# z& `& g* A5 j) d' Z" ?" g  c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) @' b% `4 G8 L# |1 _/ h
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) Y3 e' `5 s9 T/ X6 o, A$ T% P
4C19:00A4   INC    CX
# u5 }' v7 l: }. y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 r6 s! E, D$ r, b  i
4C19:00A8   JB     0095     ; 6 different commands.2 @, d  R( e0 b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.: P# C, v+ L5 Q4 n: e4 i4 L8 ]
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 Z2 B; p% Z6 C, D) C' @7 b6 |1 c/ ~" `! g6 _7 X! ]$ @
The program will execute 6 different SIce commands located at ds:dx, which( L: q9 w/ W# U3 x: o# p4 `- W: b
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) J7 ]3 a3 |1 K" l6 w; X. w4 ~
. x0 w8 O: B% a6 X; F' B* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.9 m  h5 m; u! }; u7 `( h' V# ^  }# X
___________________________________________________________________________
) L& g9 g6 S0 Y& y  K8 G
1 j7 o/ m" |2 d& Y
9 g! J) C2 ]0 r+ r8 D# s! O% YMethod 035 l; p' ]1 s# l- `/ A' E
=========
8 y; S. t) P8 u: k
; F, b" W8 q. S1 mLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: O3 g7 d3 ]4 s7 V(API Get entry point)
, e& O, p4 f; h0 }, V- u! N! @( D        & C. p! Z. }% R6 _' X
* ~' L$ V* y# S
    xor     di,di
' w% y  i' g) ~+ c; A& V    mov     es,di4 }% m# \, r/ b- i8 h: C7 Z# J
    mov     ax, 1684h         m& U* J) L8 _6 Y" b
    mov     bx, 0202h       ; VxD ID of winice
5 K& J, |: m2 K0 L' C- p    int     2Fh
, m1 ?2 H* P% N4 x7 E$ \    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 ~0 L- W1 n  T    add     ax, di- F' G. J! K* n4 e# N% z  o
    test    ax,ax
  L) A8 O4 e2 a0 d  \* x& A* i. Y    jnz     SoftICE_Detected
9 H. n3 J$ ?/ O' ~9 i) l0 V$ w7 i+ Y4 a1 x
___________________________________________________________________________& C) d5 S  Q4 G% w; }
8 A/ |2 u5 h# m) P& r* R% q, l! j* _
Method 045 R# b8 O9 R5 N" ~$ |
=========
. C! T/ D3 a( H; X2 U: j8 |8 u; f9 s& W' o
Method identical to the preceding one except that it seeks the ID of SoftICE
# Q' _2 N3 Q% y1 |* L% i' wGFX VxD., _$ h$ H  j+ y
6 X& l' G' h7 B
    xor     di,di" f9 B% a4 S( y$ w; S8 j! F
    mov     es,di0 h8 i3 f7 F" M% Q3 D( z9 R
    mov     ax, 1684h      
$ P, R% _/ m* |& b" M( C    mov     bx, 7a5Fh       ; VxD ID of SIWVID
9 q, H2 J7 S* f( w% w0 Z; j+ Z8 \    int     2fh' B& g% H. W8 F& ~1 U0 J9 T
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 b1 L" @/ G, Y* {
    add     ax, di
, v/ O1 @5 \% B5 w! V# A    test    ax,ax$ Y3 f+ t! ]" b% {# \
    jnz     SoftICE_Detected
- G" O4 x! m2 H
% E$ m' m. Z2 h; J3 U__________________________________________________________________________
7 b4 D2 w& t; }# I& U0 j3 L" l9 _: u$ v; m, g5 d

& N, L. P3 R- ~4 ]0 r: vMethod 05- J  I5 F5 i1 _* V
=========0 ?, h) ]9 g1 ]7 R$ @( n, T

# ?" }$ _4 E& [' ^: RMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# B8 l* b( `) i2 C3 i6 t+ _( ^  Hdebugger. It calls the int 41h, function 4Fh.4 d+ r  B+ P; b; ?1 L1 w  f
There are several alternatives.  
2 N& _' h  p+ U) U3 a5 E" ^2 E5 y3 L* c; F- x; A0 }. ~0 B8 i
The following one is the simplest:  L) o& W' }! Z. [& B

2 d$ Y2 E+ u3 _& `1 s! O+ ^6 s    mov     ax,4fh6 m: i8 F4 n' {$ l1 x! l3 V
    int     41h; I* B  t! g! \% C
    cmp     ax, 0F386
% m+ r7 K' |7 {4 @5 T    jz      SoftICE_detected
2 P. C. k$ G! F
$ b- Y6 Q* E8 |( [4 q+ Y0 K# d8 X
Next method as well as the following one are 2 examples from Stone's
4 M6 Y4 \. B0 O2 e5 k6 j6 ~& L"stn-wid.zip" (www.cracking.net):4 m8 e! K/ j; E/ P3 s5 B
9 \( \, D) r+ z! t7 b; L  l
    mov     bx, cs
; P6 Z/ k5 i  L3 x' I    lea     dx, int41handler2. \4 U# D0 t: a9 ~
    xchg    dx, es:[41h*4]
; D0 [8 p9 u) r5 Q+ e    xchg    bx, es:[41h*4+2]* B5 W. `" F( h
    mov     ax,4fh2 t7 A9 |$ F7 z  p
    int     41h
' |3 b) a$ q. |, k  N% l    xchg    dx, es:[41h*4], q1 C. e( R5 O7 u4 k' _- g# W
    xchg    bx, es:[41h*4+2]3 F. H7 N3 v% p9 L, t2 T& X
    cmp     ax, 0f386h) v! s+ B) K. }* N+ T: s
    jz      SoftICE_detected
$ U' h4 {3 ]; z2 C& T
, z5 O1 O- K+ b& ]int41handler2 PROC
* G5 _- T" Q5 m1 A5 a+ V    iret
5 t' b$ b) l5 d( }4 Gint41handler2 ENDP! Y. L5 k+ Z# P2 x) y9 Y* x

# G5 M! R- p" T5 L7 A( k( ]( U. E; c! T( G& s3 i4 p' V
_________________________________________________________________________
9 r. s& ], V- L/ A7 O! s# @9 V7 U8 ?; r. n; E- }

$ o+ S/ Z. m9 S! e- q5 x: T  E6 yMethod 06
& I! A. `% `3 i: G=========5 `4 W0 J1 E  X' I& ?, l

6 x3 ?6 ^. E% x' D$ Y) c; |
0 e0 X7 y. l% b* @2 o, `& k  u  ~2nd method similar to the preceding one but more difficult to detect:& K& y$ b  ^" E3 q4 a

8 ], S) i5 w" y6 r( n% ^/ L9 K
! y! d8 g6 ]9 q( Q4 |* F( mint41handler PROC4 x2 A4 u1 Z% o
    mov     cl,al; P) M( `  T! H% [) h( q
    iret
2 b2 {5 r+ {9 T) s# P+ g# _3 Dint41handler ENDP# X  j- v6 [' b/ ?3 T, {, Q
  l! V9 S0 w+ [* |$ n
8 R/ K: S7 Y) T
    xor     ax,ax) x, T# O) j3 v* c/ f6 f
    mov     es,ax
( Q* L: `7 ?2 x    mov     bx, cs
8 O/ E+ E; Y0 e; t4 D6 `( ^    lea     dx, int41handler
( g% b/ `; p; d$ l- _  @! v" C    xchg    dx, es:[41h*4]
% b$ [3 h8 N. P* W# e6 h4 W( `. ~    xchg    bx, es:[41h*4+2]
% y  @: v5 i8 R    in      al, 40h+ u" ~) [, T3 ^2 Y' x. S! \$ H
    xor     cx,cx
, r/ m) d" H3 {" D  m/ _7 ]    int     41h9 r$ ~7 |9 _& m- i6 k6 ^
    xchg    dx, es:[41h*4]
0 ^7 v8 Q3 L6 x$ u" F& o4 `    xchg    bx, es:[41h*4+2]
% Y- Y- G/ R( s! g. Q2 {    cmp     cl,al
& x4 p/ i) d- X) d/ l$ N* @    jnz     SoftICE_detected
6 H* T. S" I4 ^, C) ?/ S8 X5 j. `, y
_________________________________________________________________________
' `5 u  n4 B* D" D. m" s" Q7 g
7 `: L# _( Y0 K$ l7 bMethod 07
( Q# H% w6 I* o: }: X; @=========
2 s/ X2 w# m, C$ B; h% v, Q) z
$ r. [9 ?5 K8 C1 o% D$ ?& I  zMethod of detection of the WinICE handler in the int68h (V86)- k9 x0 V& b/ w6 }* [. ?
" j7 c: X2 J! v, e0 s& q+ v  I/ p
    mov     ah,43h1 y# D- s5 I+ a, U0 U2 z/ x* f. Y
    int     68h
4 ?# X- l3 I) n; G4 [    cmp     ax,0F386h
) [( t8 P; _/ Y( B5 b" r7 i, q( Q    jz      SoftICE_Detected
( `7 Z+ a8 Y6 E, T8 n( N9 Z' ?* T# r* v. E* j  H& ^+ k/ c1 d

  W) F* S. Q5 Y* p4 u" n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ T) P9 F3 _5 `$ T: u   app like this:
! D9 r% w. j/ A  @) G8 h6 q0 _
  Y! M! B- @5 F* K5 m   BPX exec_int if ax==68
8 w* V+ e2 K  D& {; Q- P' A8 t   (function called is located at byte ptr [ebp+1Dh] and client eip is" p# U( t) c- T( S3 {
   located at [ebp+48h] for 32Bit apps)% V+ b; o: P4 b1 w( ?; ~: b
__________________________________________________________________________
5 ]; ], \8 r  _% h6 T2 F9 H4 t% v: |
; x) c; A& J! c8 r8 F2 _) l% v) N
Method 08
7 A9 h; `  W: n=========
) k. p( c- ?3 O$ i" d
9 e4 E; n" \8 L1 C' Y- P: g- OIt is not a method of detection of SoftICE but a possibility to crash the: T# z$ h+ `# o  w/ B4 ^. A! {. n
system by intercepting int 01h and int 03h and redirecting them to another
. q% l3 U$ h7 ]9 P/ _routine.0 r! S/ m( _4 T# i# K% h4 n" r
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points+ a- H/ e( U: |
to the new routine to execute (hangs computer...)5 @% T  Y$ i$ d" p0 v/ W  T

! e! E0 k* w& q8 S" R9 x& J/ z    mov     ah, 25h
1 f4 K8 L0 y& X, W& A9 m9 t    mov     al, Int_Number (01h or 03h)* R3 M/ H8 C* K) ^
    mov     dx, offset New_Int_Routine3 ^7 a" a9 \& e" v$ r! Y# D
    int     21h1 r4 o, q; U- u5 o8 ~6 w/ h' [
" Z0 l# s) N8 n8 k" O
__________________________________________________________________________
* |/ i: L' e+ V$ T: L- N) {9 H% L
3 H. {! o* R% @- N, M" A7 lMethod 09
  B# c2 V- G( B) J6 D+ h2 \0 T0 K=========2 u2 v8 h5 o5 ]6 A: M: k
7 \7 s# Y% |# b4 R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: }0 s: X" Q1 P! W2 operformed in ring0 (VxD or a ring3 app using the VxdCall).
4 m  D' t. W0 A5 \1 F. FThe Get_DDB service is used to determine whether or not a VxD is installed- V0 c7 P+ L7 r& A, f  M5 K& |/ z6 [
for the specified device and returns a Device Description Block (in ecx) for# c/ l9 m# t7 f
that device if it is installed.
  x/ K4 x/ E7 |6 n( {) z/ g
& H, [2 r$ ^0 A   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID' v! v$ y, [! j0 \
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 B2 p0 e7 w( y2 c
   VMMCall Get_DDB
% ]6 n: @: a8 Y" M' V) s  P  z   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# i* j) f  l6 Q+ v- ~1 s0 f+ W! a7 K5 R8 B0 _2 c3 E
Note as well that you can easily detect this method with SoftICE:4 s7 b) S7 v3 F- S
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 N) j4 Z, t  ~7 x0 A0 k; y
) p+ S+ _( O- D1 ]* q: b1 B__________________________________________________________________________
5 ]& m* o. L7 O9 p3 u" [2 o  e
3 j8 g6 \; C$ c8 Q* i  cMethod 10# [0 x" ~- g+ Z
=========, |8 y4 j! m" {( m4 N0 Y8 t

' f( @2 E0 Y" S. S' N=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 c" a9 s& C8 g. }# A  SoftICE while the option is enable!!' ]5 |6 n+ Q7 D$ g

  J! k. d, k1 y% nThis trick is very efficient:
; r" V/ w9 j4 L8 N/ _by checking the Debug Registers, you can detect if SoftICE is loaded
- J% }0 V7 j$ k6 M% s% C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' `2 P3 Q; L% @5 ]5 Cthere are some memory breakpoints set (dr0 to dr3) simply by reading their3 s3 x2 w4 b$ I/ T2 P; [
value (in ring0 only). Values can be manipulated and or changed as well
- X  n  c  }1 P(clearing BPMs for instance)
7 X: W$ v/ f8 ~* b. d  A
4 \: L0 L* `) h) L7 p__________________________________________________________________________
  D% X% E5 n+ O2 n, E+ F' K% g2 v# @8 L5 d2 C# Q
Method 11, O9 m  f8 c% o4 w6 p/ x
=========+ \/ ]- ?. l* I, C" a

6 C7 H; _+ [$ x7 KThis method is most known as 'MeltICE' because it has been freely distributed6 ?% s8 R3 ?, @" O2 U/ t4 p
via www.winfiles.com. However it was first used by NuMega people to allow* d, p# E* R8 W5 w( k6 s1 D
Symbol Loader to check if SoftICE was active or not (the code is located
" z& ^3 }' p# R% k$ Minside nmtrans.dll).
& g  c* K% b2 X$ V* ?  A. y( }, Y( f. s
The way it works is very simple:
* n& V8 y4 L1 IIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
: x1 Q0 i3 C) S6 BWinNT) with the CreateFileA API.
7 r( I4 k9 e6 H# F9 [, G0 e: f- v1 f1 Y' S! P0 U
Here is a sample (checking for 'SICE'):& e+ Q( x8 v. W& Q

* U0 V) N$ a; O- _: |& lBOOL IsSoftIce95Loaded()
, e2 e9 l- x- _, z: A{6 f1 }/ x/ x% p$ \
   HANDLE hFile;  * f8 b( h8 Z! r# f
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; r  S$ m* L4 ^* F7 m# q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* b5 p3 V- I) p% I8 j                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 \3 y2 S! N9 u7 p; M) y   if( hFile != INVALID_HANDLE_VALUE )
9 x! g" H7 _# Q* o8 o# y   {
4 ~' z/ I5 J# J2 g      CloseHandle(hFile);8 t- O. \# v( D' ^
      return TRUE;
" I* X* P7 m0 @' R   }6 ]: X' {7 m7 C8 G: y
   return FALSE;  X0 G' {( F7 k1 T' o9 _/ N
}) t- q" I& {& c: m" e
/ X" U+ [  j! L8 ]
Although this trick calls the CreateFileA function, don't even expect to be+ k. \( y7 f5 V; g1 Y4 ~- T
able to intercept it by installing a IFS hook: it will not work, no way!
' @  I/ K/ S7 ~2 J( SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
& I4 E6 h1 V% `2 S9 Lservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
: J6 j0 {/ f! hand then browse the DDB list until it find the VxD and its DDB_Control_Proc0 V: o+ S" W6 z+ j' c1 [0 X
field.
8 a8 f4 r$ X1 T. Z7 tIn fact, its purpose is not to load/unload VxDs but only to send a : w0 u& u  g. z, i; E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
( Q# g1 L, T+ ^2 p0 G" Pto the VxD Control_Dispatch proc (how the hell a shareware soft could try# U! r9 H+ g3 v- I! j9 _( K% E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ r, T0 i. D6 F( ?  WIf the VxD is loaded, it will always clear eax and the Carry flag to allow
" X) E& ]% J3 {# ^its handle to be opened and then, will be detected.( R' T# G! c! W8 C
You can check that simply by hooking Winice.exe control proc entry point
0 S) D% E+ o, [: a2 mwhile running MeltICE.
! K* S+ y6 j$ U: |. l5 I$ }2 l
% Y1 F/ W2 D) h5 c4 \  Z% g; C5 Q0 h
* P; |" L% E" W$ [  00401067:  push      00402025    ; \\.\SICE; b7 ~2 u& d: b+ G4 P( `8 g
  0040106C:  call      CreateFileA" P. T6 v% c, k6 T2 I
  00401071:  cmp       eax,-001
, w$ F8 O5 r  K& @& p' S/ N  00401074:  je        00401091/ P. J4 x' F& O8 }/ d
9 \2 l& N3 c4 R* U

8 f0 ]. \& a1 ?4 i; c; D/ q2 J5 x  ^There could be hundreds of BPX you could use to detect this trick.1 F0 f7 ]. V" f# _
-The most classical one is:  M0 T+ Q3 i2 o* K" y
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) d# G, i: b0 y2 K. B% {3 i7 @2 o
    *(esp-&gt;4+4)=='NTIC'
9 U( r+ e% w0 k! u/ I5 A
) @0 X" a/ u2 X# e- x5 r-The most exotic ones (could be very slooooow :-(7 j$ Y% E0 p3 f
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 x* _; d' ~# V) y
     ;will break 3 times :-(4 z9 A, h" d4 @" G4 c. Q  C

: r, B' P! t- C: ]" r6 F8 H-or (a bit) faster: 8 F3 j5 ~7 P4 ?1 A* g0 j; m  s
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 M7 u; @" s* p. f1 J
# e* |2 ^9 Y- i. X5 f0 S+ l   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 t  D# c5 e7 v% J4 c
     ;will break 3 times :-(4 j0 v( q/ J1 w$ `) j9 n$ b

  v$ e2 b  a& P-Much faster:
7 T2 S- Z( J# ^# }, O4 n   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
0 x* Y, @) e/ R8 O. A  L2 l  N4 N0 c3 c- W/ I
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; s0 d+ R/ v4 J- a; h, _
function to do the same job:0 A: P& b# _0 b" [: Q8 ^

$ |" u9 k' j( h# |8 J$ h! r- h/ n   push    00                        ; OF_READ
* a1 j) p. p0 s7 ^: f, x% N3 Z. o   mov     eax,[00656634]            ; '\\.\SICE',0) x* P. L% Y4 @7 j- ~! Y
   push    eax5 p0 b2 X& S$ G3 k. v, ^: ?  v! y
   call    KERNEL32!_lopen0 a9 T+ j$ \+ H) Z' ]' R! T
   inc     eax1 F% n$ P1 D+ ~1 P; }2 V
   jnz     00650589                  ; detected5 v3 ?" L% W( h/ }/ Y2 Z
   push    00                        ; OF_READ1 F& D' }; q" H0 y7 E
   mov     eax,[00656638]            ; '\\.\SICE', [/ V2 n- W2 w& o/ u( S0 ]9 s
   push    eax/ f8 x( y# t$ I
   call    KERNEL32!_lopen$ R/ b# {9 N# S, S0 `' o" q8 p8 ?
   inc     eax5 |& S4 ?: Z  s7 X' y. k1 H
   jz      006505ae                  ; not detected7 s8 B0 F5 }4 M4 ~4 J2 v

3 W, ~- n7 T7 G, P, s# M  o: I! O2 y- `  s( _( b# }
__________________________________________________________________________
3 T+ @9 ~; F2 W7 K9 H
# m! h! H# i2 bMethod 12- O7 R/ d; L2 F, Q5 H
=========) x3 i; p9 u9 @4 k, b- S! {$ y
9 h' Z, S# o2 @/ _. F
This trick is similar to int41h/4fh Debugger installation check (code 05# z- m4 ?( }( H1 M
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
5 ^: Q6 K$ x- K6 i1 X* G1 z9 Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.- c$ c* C4 F% N) U- [7 y8 F
2 A7 g; I5 Y6 o7 _+ z- t1 [
   push  0000004fh         ; function 4fh
' F4 P% u+ Z2 q; f   push  002a002ah         ; high word specifies which VxD (VWIN32)6 r0 S2 i( }/ m- U$ c2 A
                           ; low word specifies which service
. d0 W" C# {1 X- B) |& e( W: e                             (VWIN32_Int41Dispatch)
  U( S& k# M  f! O  Q" J' Q   call  Kernel32!ORD_001  ; VxdCall
; A/ L5 }, S7 l6 E9 W" K  Q   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 A. u$ [. A, O  o4 I  _0 `* r   jz    SoftICE_detected
9 u6 z. L0 e6 _' Y( ?7 n
: F8 G0 W0 v: n8 e, E' E+ uHere again, several ways to detect it:4 ^6 e" ?& C6 X/ D7 V# R7 \8 D
0 [' W+ P/ ~% H
    BPINT 41 if ax==4f8 t" R$ d! F( i1 z6 K. n! t" o0 I

  i2 ~' b8 U2 Y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 A# e! p. U) X! i, j) K# W3 N) a* L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 c" c( |2 G# z2 X" {3 Y$ e

# ]. b% O3 W. f2 n" T# D# e    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!; M7 T5 Q8 I6 t3 [

8 }4 r5 q; B) Y+ z+ p__________________________________________________________________________$ c5 D- v7 k( m4 t, `8 `- J% U: k
7 u, z& u4 W$ C/ t2 j7 Y
Method 13
4 A) K7 x" x( g=========( i% F9 g3 @7 w8 I. Y

5 ~; f7 c( g; o, p& e; mNot a real method of detection, but a good way to know if SoftICE is( d1 r7 x4 W0 K5 p+ }9 B
installed on a computer and to locate its installation directory.+ p0 |! f* {+ {3 e( ^6 q" U
It is used by few softs which access the following registry keys (usually #2) :
9 U4 w/ L( l0 ]  R, q5 B; g& t7 `+ ]
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) a- C7 J7 G1 P/ H9 v$ ^
\Uninstall\SoftICE
; x0 J6 D+ d" @& i* b" l-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE7 Y, _" u3 ?- e+ |7 W3 k- Z' r
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ v8 E" q& j% D9 m1 C7 g
\App Paths\Loader32.Exe, E4 f; @8 c4 [. Y

. p5 d7 o+ ^3 q  ~1 ^3 Z  t" F0 R2 f4 g/ e9 W! p
Note that some nasty apps could then erase all files from SoftICE directory  Y/ x4 ]9 m) _0 S  H' [
(I faced that once :-(" j1 ?/ E4 a3 E, r& r$ @
; Z: x! P+ R0 W- }
Useful breakpoint to detect it:3 l0 W& {, R6 @# @/ }

0 E. k4 H0 A  X# u: t  q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% z0 Y9 W4 j' E( f. ]# {' }) l
* q6 e/ j/ f8 a/ O
__________________________________________________________________________
! c" _& T! e0 z- h
3 k2 |2 Q# B+ @3 z: g
9 v0 P2 T; N- ]! B; t+ s* BMethod 14
' T+ e$ v5 i( F9 R8 \& S" D8 ]=========
! o1 P3 L/ p8 ]8 [  k
* `8 F, R4 k* P, U. |+ ?A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ M) R5 E. T8 f. j3 S
is to determines whether a debugger is running on your system (ring0 only).8 _- Q/ |8 I' j+ L$ N
  c! U, }2 x7 t' e5 w
   VMMCall Test_Debug_Installed) S4 ~2 _* E% b$ \
   je      not_installed
6 y8 Z2 P9 i: T9 y
" x2 n# d" d# x. V5 L4 f: m$ DThis service just checks a flag.
6 H6 {( x+ ~) h  Y1 w</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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