找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) d8 ]9 {: U; v! w6 a
<TBODY>
& V; ]0 y6 C% K$ a; I3 y<TR>$ j  ~1 R2 k, U7 a6 x" D! y
<TD><PRE>Method 01
7 k" i6 f) [( {: o7 |=========
3 `) G5 z' g9 V( E3 ?' _$ U3 {4 B2 r
8 B% ~' x; _# }$ l' j# g. d3 m2 LThis method of detection of SoftICE (as well as the following one) is/ E/ G# h2 o6 G
used by the majority of packers/encryptors found on Internet.  |' Y  ?0 a% r8 L2 S& u) [4 i
It seeks the signature of BoundsChecker in SoftICE  m0 m2 d6 k! P

8 k# r4 q0 d9 G! y& U5 B    mov     ebp, 04243484Bh        ; 'BCHK'
2 Z$ `' `9 K  y    mov     ax, 04h! ~5 _. L4 u. Q0 E! f- O% w
    int     3      
8 U' G  L3 C; P8 ?" d    cmp     al,47 e2 _8 Q$ {! `
    jnz     SoftICE_Detected7 p# v2 ^1 M& u) P  y
) |7 g3 a; ]. R/ d
___________________________________________________________________________- f' D9 L$ }' j
, _( r/ Y* B# Y- I* W7 U
Method 02
* I1 s7 {/ k/ L=========
8 q( L" @' P; s( m# O2 G
1 n, C) Y; X1 ]" x) lStill a method very much used (perhaps the most frequent one).  It is used! K/ T3 C' \$ ]4 t- p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
& V! F& z5 \# n) E2 S1 L" \or execute SoftICE commands...
0 L7 g6 F/ c3 _# p2 d+ _( A8 [It is also used to crash SoftICE and to force it to execute any commands
2 w+ y& N% y' R6 T* o. r(HBOOT...) :-((  9 q- r& K1 q, m+ L4 B
) k! T( F, f, h' w* w; N: O
Here is a quick description:
; k8 S, I, d- k7 K- s  b9 J-AX = 0910h   (Display string in SIce windows)! z1 m7 O& D- Z/ a0 y
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 H& f$ N* s2 p# E
-AX = 0912h   (Get breakpoint infos)
* _  C& i( i  Z3 v+ o, R% Z-AX = 0913h   (Set Sice breakpoints)
- w/ ?& \4 J) q4 R+ B. L-AX = 0914h   (Remove SIce breakoints)
! h0 f; E7 x* O+ U1 ~5 W( X# j5 D
Each time you'll meet this trick, you'll see:
+ M5 @/ I2 {) v: A- j' N" r-SI = 4647h$ {. h. @" g; p# h0 X8 i+ i
-DI = 4A4Dh/ O; t+ z, K2 j7 D" K& s7 P
Which are the 'magic values' used by SoftIce.
" f  ~; Q8 N9 Q- Z* @3 BFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! [* v  e% x! q# X- |( W) ]9 I& I9 p. V. p6 z- Z9 M( Z: F
Here is one example from the file "Haspinst.exe" which is the dongle HASP
4 T, x* c) ?  z, T4 gEnvelope utility use to protect DOS applications:$ F; E; u/ |  O6 w

1 B/ @  B5 s8 T4 P
& f" C5 Z; `( a2 p4C19:0095   MOV    AX,0911  ; execute command." C* P7 `' O& D6 S
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
8 U% v5 s5 a  o) _# F$ m) {4C19:009A   MOV    SI,4647  ; 1st magic value.% D9 A( ?+ G; ]2 Y
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.2 f2 D. S( F$ G; r- o
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
/ K0 Y) h* _+ y/ Y# u4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute# @8 ?  l# `9 V
4C19:00A4   INC    CX
6 @/ D: ~- G$ p  e# O5 _4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: A# I! V5 ^  O# r1 k, C8 I- v
4C19:00A8   JB     0095     ; 6 different commands.
1 q0 E. C: o8 C$ a! M0 P& h4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) M( P6 j4 H4 F* e- a% T( [8 l
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ F- C6 ~2 G* A

/ f( N: F7 a% @The program will execute 6 different SIce commands located at ds:dx, which" d% d8 o+ y9 v8 g% n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
6 ^$ m2 C8 c6 t6 R+ F
+ d9 y, r/ u) C2 `- L$ Y7 Z1 O* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.2 I4 z- J' |& w* k+ g4 h
___________________________________________________________________________
) @. W1 T- K: c! W  d, k( [' a  A

% E  Q0 v9 @0 @7 q3 K  a" uMethod 03
& t1 Z9 ?; x, ~) |3 Z1 R4 {=========' y" a) Z% p" ^; W6 m* H1 l
1 h; p: g' [  z  q* |9 c+ Z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
+ D, q7 c( p6 P9 S" N(API Get entry point)
; ~9 Q! ]0 W* n+ \7 o        0 d  B& u# G* h. `0 c
6 V1 K& T" `3 H. [
    xor     di,di
% B1 @' O7 a: y1 M! e. y  ~& a    mov     es,di
. b* e- r; b1 {3 L    mov     ax, 1684h      
) o" j  e3 j& v    mov     bx, 0202h       ; VxD ID of winice
- C( y; F9 a" s4 P    int     2Fh% H, [& D+ P1 }. e) H
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" p" }$ ]: }( }6 D2 `
    add     ax, di
$ F* Z9 E' n) c4 v, O+ u5 W    test    ax,ax
4 D3 ^# D) l& P+ q8 a9 N  w+ }+ C+ }    jnz     SoftICE_Detected9 I; T" z$ {( s& R; }2 A3 V

7 {  y4 c/ }, X___________________________________________________________________________
* |# s8 N/ W9 |2 t0 E/ d- T. j  z, @- v3 A1 k$ o6 X7 E
Method 044 D/ n: b+ C+ r% g- [, @
=========# q& w7 X, c& ]1 W4 T- R( D4 I
4 u$ v" y* d8 G! b6 `
Method identical to the preceding one except that it seeks the ID of SoftICE8 _$ h' J; R- @* J9 [: i
GFX VxD.
, Y" `% [/ ]  I( i, C. P3 i) x: G+ ~: W* |0 U# c4 q( T9 {5 y( Z- m
    xor     di,di
9 D$ h4 W4 q- Q- z% z    mov     es,di5 }' h4 B! D2 B* x
    mov     ax, 1684h      
5 `' v9 P2 v7 K% Q5 g    mov     bx, 7a5Fh       ; VxD ID of SIWVID- B% k( F% d' h/ P+ L
    int     2fh
+ ~6 Z$ p7 g5 d4 s- Z% K( v    mov     ax, es          ; ES:DI -&gt; VxD API entry point
6 y- c  |: C4 [, S) S% H    add     ax, di
3 k0 K$ p- J( }4 ^1 U) Z8 @( \    test    ax,ax
% y/ p5 }4 k1 _+ \0 X    jnz     SoftICE_Detected
7 f. Z% N1 [8 O; @
. y9 |! x2 ~0 ?  ^& V& p__________________________________________________________________________
1 M+ g9 ]" I7 ?; _" B
9 I& R- |; c+ w2 c" \4 z' ]) K$ J1 v+ j$ g8 W$ X0 S
Method 05
$ {, @1 X2 y3 S( c# d/ C=========
& Y' a8 z: m2 D) F. ]! ~1 h% k- E1 @: }/ \& i: |  S
Method seeking the 'magic number' 0F386h returned (in ax) by all system& c, E0 C  X- g. N3 ?* F
debugger. It calls the int 41h, function 4Fh.# A; G3 d" [' h9 Z* q6 T8 @$ j
There are several alternatives.  
4 s$ G$ B# r( ]6 o; Y8 n; O. Q. B) |/ B
/ {, E' L( r. u: `2 q7 |The following one is the simplest:* [$ E' I" a6 s/ v
1 V7 w+ G5 ?7 q7 k, \
    mov     ax,4fh% d& {6 x  G/ @- f* v% G
    int     41h
7 f3 H% i3 F0 D# |  B# x    cmp     ax, 0F386
& s" q9 ?' n: M/ E3 r: m    jz      SoftICE_detected6 ~& m$ L! P! K* T1 B, d7 x
: @& U5 B6 ?; o; J0 D

/ W; Z- i1 N! A! }' G# }; D; wNext method as well as the following one are 2 examples from Stone's ; K7 H) z/ o( @
"stn-wid.zip" (www.cracking.net):
8 i7 i5 l# d& O) {6 n" ^8 W
' Q% \) A8 X" c1 Y, l    mov     bx, cs
! Y% q4 b' B2 l+ i    lea     dx, int41handler2- |" P( Y7 F1 J" G4 m6 F6 x# e
    xchg    dx, es:[41h*4]
2 i: S4 n: _. F# X% W    xchg    bx, es:[41h*4+2]. f: }. i' D# c, T
    mov     ax,4fh1 }0 Y1 h; a9 @/ c0 `. B. A
    int     41h/ ]7 c5 |: n3 N7 g* A& A" u# l
    xchg    dx, es:[41h*4]! [0 n( \1 E# B, s4 R; |) M
    xchg    bx, es:[41h*4+2]9 |; v. R2 o! J1 O8 {& n
    cmp     ax, 0f386h5 r2 @$ a9 Z. \/ s0 l
    jz      SoftICE_detected
. t8 S' _% r& W% J0 I+ }/ g4 [/ _3 v" k. ~+ @% \9 Z
int41handler2 PROC: k- Y& W, a& `
    iret0 d( M! P0 W# U( F
int41handler2 ENDP
) a5 J0 i, R9 O# V$ c/ V% j% r, l+ i, W7 p# L. j, d
5 b7 @7 B6 r1 y' p  a
_________________________________________________________________________" m! U; a5 [+ p- i* u6 D
: H8 f6 l, {2 n& w/ G

! W) T0 P1 L* ]; tMethod 06, o9 M- P/ k, t5 `
=========  q/ T  `" w  C, _) U; ^

4 T! S$ g8 ]' k5 Y9 g8 @2 w3 J  j
) b' _2 n9 M  s2nd method similar to the preceding one but more difficult to detect:5 r& N3 {, S# C3 h

5 N" _! Z5 i: b. A! Q$ ^9 A' K' p- a
int41handler PROC
3 k) M, x5 z/ U& A3 V7 j    mov     cl,al3 P9 K' D7 W6 I- A+ T
    iret
. V, _( z" {9 H( J& J0 I% w" T2 Oint41handler ENDP
2 h' ^1 g/ P  `3 a0 ~; ~$ i! I; ]$ u% `& K7 y# u3 G1 j# i" x0 ?

# K* ]7 B4 _1 M9 l' Y1 r- e- L: Z    xor     ax,ax5 r* L# }% y! ~. W% O
    mov     es,ax
! y3 i' p8 b% j+ J+ q" X8 l8 d) L$ M    mov     bx, cs
# w& _& i) l/ V    lea     dx, int41handler
. t! _/ E* D  g! _    xchg    dx, es:[41h*4]
1 N! J) i* h3 N) Y2 ~    xchg    bx, es:[41h*4+2]
$ x2 h+ v5 s- ^, ?+ m    in      al, 40h+ d8 }( [) b* D3 O6 n6 n
    xor     cx,cx  o6 a9 J6 ?* b
    int     41h6 @2 Q0 u8 g# n0 ]% ~  x% N! n5 X
    xchg    dx, es:[41h*4]: W2 l+ X$ L1 `$ M. M  Y; M! @
    xchg    bx, es:[41h*4+2]/ ^- v4 X9 {) k( |2 u
    cmp     cl,al% g. u/ A$ C, h5 m: O
    jnz     SoftICE_detected
& V- K4 F2 P+ d, g0 E% ?1 W$ C( d, v) ~# v1 P6 w  p
_________________________________________________________________________& T- q, W" _) `! G$ ^

3 a0 t) i+ \1 g+ p/ k* NMethod 07  p# ^1 a2 H3 p6 l6 y2 c
=========; U" R0 F+ |) L- D9 T* p) i

! q/ K. K$ M* I' X* [+ W* QMethod of detection of the WinICE handler in the int68h (V86)- s# r' I" p/ h( t; H

+ F2 I+ k+ A8 L- s+ w" F/ t    mov     ah,43h: @+ M* ?0 ]% \* m* @& X; |4 q
    int     68h
6 w8 x2 z; Q; b8 r% g8 I& u    cmp     ax,0F386h
" p2 `; H5 ^' J' _# E; u4 b/ B8 o    jz      SoftICE_Detected8 x4 I% E) S! B2 @# h0 F! D
3 Z4 e2 `' C. B$ Q8 L6 u8 m  C9 ~
# U8 a+ M0 i5 ^, ]) M
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% e. u& L( i9 R* c8 T   app like this:) `9 b( D% [' P) }

) x" K  Z2 r$ ^# {- |   BPX exec_int if ax==68
6 H" |; t+ Z% a" D   (function called is located at byte ptr [ebp+1Dh] and client eip is$ o, F8 l+ Y, |
   located at [ebp+48h] for 32Bit apps)
# t7 m& S& |) }$ L# [! y__________________________________________________________________________9 P+ s2 ?* L: f$ A) d  @) P  t

2 F( T- x6 B( g7 X* X4 B; G- T0 P  t  y" W, s
Method 081 @' p7 s8 c& T! r
=========
0 }+ z3 g( z+ T: D0 M- K7 M( ]! ~3 a, i  }0 l
It is not a method of detection of SoftICE but a possibility to crash the1 C) P/ P2 o  o5 o% f, P
system by intercepting int 01h and int 03h and redirecting them to another
5 u. |: T$ O7 Q0 O- A& Wroutine.
& p$ `6 a3 E5 {0 R9 T# `It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ e0 g( C6 }0 i2 `/ \% f/ Cto the new routine to execute (hangs computer...)
) Z% R+ E+ p( F4 D4 S/ G7 z, Y. j( o' I$ x+ `( o6 ]
    mov     ah, 25h
* e( y6 O2 i1 \. x7 T# k/ W    mov     al, Int_Number (01h or 03h)8 s8 o- e) t2 y- w; [* t% q9 i
    mov     dx, offset New_Int_Routine# J9 Y( t) V& K
    int     21h
# w& M3 P/ m, Q3 N2 O6 {1 S* y
8 F6 D1 ?0 ~" W* a9 A; H# z__________________________________________________________________________8 z: q& Y  k* m+ s  M) X3 E, @
; t: c; y3 h& v
Method 09
4 D; E# w) i* t0 i2 k' V" n=========
# }# i) }+ w2 \' ?2 F& ~" S% Y
7 x# _  _0 u! B- r% a" u$ Y1 gThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 p: p6 W; k" f5 n9 sperformed in ring0 (VxD or a ring3 app using the VxdCall).
* o7 s! A( C; x! N2 `+ oThe Get_DDB service is used to determine whether or not a VxD is installed8 S$ ~$ [- M. \, q) q
for the specified device and returns a Device Description Block (in ecx) for. G- g  c' |7 P0 B3 U" q- f
that device if it is installed.5 w% f8 u# _6 a% r1 |2 h; _

: ]# d, w. `9 ]# |& P1 k! i   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ ]# h9 R% |$ ]& T5 T% F  V( ^% b
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# a# V: W5 A0 t$ `3 z6 I   VMMCall Get_DDB
6 g7 E/ A3 n+ f# G3 ?   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  P$ }! z; d' W' M$ g8 ^+ X& D4 P0 V% }- ^8 \( r) A5 _
Note as well that you can easily detect this method with SoftICE:
; Q' `( \, Z/ B9 _! _   bpx Get_DDB if ax==0202 || ax==7a5fh+ S( W8 |3 F6 Q. t0 b
( K! N0 y! w3 p/ [5 x
__________________________________________________________________________, z3 h& I: Y9 @; S5 J2 m
1 n" u- S' r' ^* z9 S% f* A
Method 10
$ p5 J, m" ]; m=========! `5 _# e, X* \
9 E! n+ [9 c0 H; T5 q3 O( }
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with4 R$ l6 W& f2 u) a- q1 O" X
  SoftICE while the option is enable!!
1 B. W) s3 R8 r+ V" x: h& U( C+ ?. Q  x
This trick is very efficient:
5 `+ Y8 S  @2 I0 E/ Q# y- Nby checking the Debug Registers, you can detect if SoftICE is loaded
( Y$ a* |# K9 u# c' C, K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
4 M0 O5 I3 v0 g* y' @+ w& ythere are some memory breakpoints set (dr0 to dr3) simply by reading their; o, {) V3 V* x1 W
value (in ring0 only). Values can be manipulated and or changed as well
$ S. z5 y3 I- W; M(clearing BPMs for instance)
3 x5 Y8 P: D/ ~6 j/ S! l+ z" Z( ]; y9 k: D
__________________________________________________________________________. |* S9 i$ u; s
6 n" e; C0 [, M, i0 t: ]4 O
Method 111 I; y1 @: P' B: }
=========6 c2 o& @* _: ^  \
( Q/ {3 \# y& Y) F  z6 }* H0 C7 j: d6 z
This method is most known as 'MeltICE' because it has been freely distributed
+ ?; f4 I: }  T0 d3 c1 Z. ]5 r! svia www.winfiles.com. However it was first used by NuMega people to allow
! b7 E' ]' W1 Q+ x/ m, Q% C; u' U4 ESymbol Loader to check if SoftICE was active or not (the code is located; _( _. a4 t: S' c# X# M! g9 X+ v
inside nmtrans.dll).
3 x9 {- k) q% K; H& x
& C: T6 ?# `% x- u: f( ZThe way it works is very simple:
. B; N- V" T; TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
3 |3 }2 i) D0 I! [WinNT) with the CreateFileA API.
, \) n/ o) l4 ?4 y: v
; w% k2 v! O: J: AHere is a sample (checking for 'SICE'):
$ ?/ f- l  o, f2 E) j" S6 Z; Y" Z1 e( C& f/ j: \/ e- {8 z6 W
BOOL IsSoftIce95Loaded()
& T0 _2 _$ f& U{
2 R/ A) O7 e$ f, h+ ]) \; y% D$ T& y   HANDLE hFile;  6 ?7 _; W5 h. P$ J  r" J0 ?% I
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  ~  v  s$ ~5 w0 v: r                      FILE_SHARE_READ | FILE_SHARE_WRITE,! S0 s. ~" h* R& Y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. [! T/ M# G/ Z0 k   if( hFile != INVALID_HANDLE_VALUE )
# T' Y  d: d" j% Y) [) i- v   {
# B% Z: d7 y% \+ b* o2 E" b  |      CloseHandle(hFile);
6 x) {3 C, X& o; L- j      return TRUE;
+ L, D' E. ?1 w; B% _, M3 y2 z   }
7 l/ v; [6 r% g# Q( |8 `, R3 ?$ ?# n   return FALSE;3 H, Z( |/ i6 {# o
}* [; v: Y  n; l9 O; L; {
# q4 }* e& Q- A2 c# M0 G( s
Although this trick calls the CreateFileA function, don't even expect to be
2 e: w. H# z. w. T4 K& Qable to intercept it by installing a IFS hook: it will not work, no way!, n3 K0 k; a6 @' u0 ~: F' m4 y
In fact, after the call to CreateFileA it will get through VWIN32 0x001F4 f* R% z: ]9 N+ _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)9 v+ F. a, ^' F
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
  |8 [( ~- x7 c$ n9 gfield.% w0 X) W7 _4 O
In fact, its purpose is not to load/unload VxDs but only to send a , b# Q- m! [% i1 i1 c9 R" j5 U
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 e- b) F% F: k2 O: a% t
to the VxD Control_Dispatch proc (how the hell a shareware soft could try+ Z$ s) O* e, @. D$ i: Q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
' s" s) ^2 L: }9 w- `4 iIf the VxD is loaded, it will always clear eax and the Carry flag to allow
$ D( _+ }2 `- \# ]its handle to be opened and then, will be detected.! N8 s; y) R' \: Z
You can check that simply by hooking Winice.exe control proc entry point5 {9 K8 g$ x0 I5 {
while running MeltICE.
  _, M6 ~# T/ [- L9 b- W6 E
7 ^/ n; o, H! j0 f6 o2 b4 p* g0 I$ i- V+ C* P/ f
  00401067:  push      00402025    ; \\.\SICE
- h% }& b( `" o. a' z5 ~; T# P  0040106C:  call      CreateFileA: t/ C, r# V9 w# T1 C
  00401071:  cmp       eax,-001. [2 Z$ D/ _+ |8 d9 O0 q
  00401074:  je        00401091, n1 e2 r/ t/ t% o
2 I$ {6 E8 ]! Y/ @& Z3 F0 }

. r5 X! Z( ], H$ `% a& g6 z* zThere could be hundreds of BPX you could use to detect this trick.
* y* v. [: O; K7 |; |-The most classical one is:
( w( c8 \$ Z( V2 |2 a/ n  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ R' ^) ?/ J+ W, |- \% w% L    *(esp-&gt;4+4)=='NTIC'( U/ S% Y% W3 }% K
. o9 F! ]3 z5 B7 x
-The most exotic ones (could be very slooooow :-(! O. r+ X  j/ `! h
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' s& h  g4 q# r0 O) L4 {
     ;will break 3 times :-(
6 r" Y5 @3 D3 h! M3 R; t
  W  V1 T2 o2 P' d-or (a bit) faster: 3 }' E% ^% a1 m7 d& \7 U
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. B6 s+ e% f! t3 q; r" m8 t$ o0 `# t7 }$ d/ p4 v% ~
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + s7 k% ^' d! X( t$ B
     ;will break 3 times :-(6 y' C5 c) Y- g2 A  A6 x2 B
$ l; P$ Q7 l1 M- ~2 h4 G9 e7 ]: g
-Much faster:! j  h( J7 B$ K* ^1 Q
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 V: o- ?. C: a  X: u
9 K" a" O; m; X
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen0 B' n+ T5 h' J4 H; r5 a: f0 p6 c0 L
function to do the same job:
: Z: H- X+ e! v$ g
8 s2 T$ ?  A6 h1 A   push    00                        ; OF_READ
' F5 F6 s( E" ]; e2 ?   mov     eax,[00656634]            ; '\\.\SICE',0( L; E6 J, c7 r$ h3 I2 V& ]
   push    eax
$ b6 I" [6 w& ^: R5 w   call    KERNEL32!_lopen/ v5 r6 A. i, W0 p1 |1 C. n
   inc     eax) l  ~3 m" L1 K2 _1 H
   jnz     00650589                  ; detected
* C: R3 v5 f+ h$ f% E   push    00                        ; OF_READ
7 Y) E: ]2 u! Y3 W5 D   mov     eax,[00656638]            ; '\\.\SICE'
) s7 d" m8 {' `) ~. B, _   push    eax
* V' L, m; X/ I7 h- u: @: @' ]   call    KERNEL32!_lopen, y( G; c7 X% M$ R7 @
   inc     eax
  s& H2 D: Y! ^9 m# R   jz      006505ae                  ; not detected2 ~" \; Q( Y$ M+ a$ p% d

  C4 K# O* K) s  O2 @$ M/ ~! L1 h0 Y( g( i
__________________________________________________________________________
7 [3 ~! D- ~/ d. k
) h. N# a* U, C4 l5 w: b2 WMethod 12
  Z1 v7 h% R2 ?1 v) X=========
/ V8 Q& ?; b; J. o7 x
- e* J6 }, R" `3 x. }This trick is similar to int41h/4fh Debugger installation check (code 05
; Y2 F; S4 x' N- z&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 K2 R5 R& R! T. `, k. y
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. [" ^) ^9 C1 ?" z7 [

8 @: \* v5 U# y! a   push  0000004fh         ; function 4fh
7 e, V2 A2 r3 E* h   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 d; i& Y# K! Z                           ; low word specifies which service
+ C- [( u$ Z) r- K6 `/ ]5 G. N% p                             (VWIN32_Int41Dispatch)
2 E1 _% a$ ~# x7 T. M- G   call  Kernel32!ORD_001  ; VxdCall
2 N- [% ?/ G& z* {8 P$ ?# g   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 g8 X6 u; v$ I8 q( y. y2 {9 h5 W   jz    SoftICE_detected
3 }  x% D' F' R& y
1 i2 w2 @4 N, K0 y9 k& [Here again, several ways to detect it:
( X6 {& U* X2 @, F6 C( w! S3 f9 I, z/ |$ p" s6 F
    BPINT 41 if ax==4f1 R" e9 [- y; N3 B# ?

. @% a& h. I8 `" b    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 |' \  r: ]7 O1 q4 B$ ~" X/ @" F: W# R4 {8 ^! l9 j4 Y: a2 G
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
" W& M: N" I9 F* i7 i
: N: C& f4 d2 R! V: N8 \5 o' z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!" D' ]! b$ a. p- F: T
3 Q6 Y+ ^7 Y" B
__________________________________________________________________________
" t1 K8 a! @4 H. E
6 B1 D& V2 K9 XMethod 13
3 _4 I# v% t( ~/ q=========
* M% S5 i( \4 d# h
) j% T1 q% E! b9 C0 M% Q2 FNot a real method of detection, but a good way to know if SoftICE is
3 j1 p1 g3 D  M7 o! Qinstalled on a computer and to locate its installation directory.: s5 t& r  z" s0 `3 X+ _( j9 r
It is used by few softs which access the following registry keys (usually #2) :
3 K* A. d& a# a; Q& V" W5 v
& ?4 d& [+ f; o) s. G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- ^' y# M  n% K3 U# u" U% O, c
\Uninstall\SoftICE2 @  P6 k$ C# F$ R2 h# f1 p( d" D
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  {: r/ o  c4 M; M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion; h- o# D5 b# ]# M
\App Paths\Loader32.Exe5 X* Y5 F& L$ ~& H7 D8 T: j) g1 y

9 h# ]0 }; A' a# ]* L3 E
/ b/ x7 J3 ^, A! b- w) nNote that some nasty apps could then erase all files from SoftICE directory" b! P0 V, a, Z
(I faced that once :-(/ Q# t6 |9 s) s  w  c; \- D
# z7 b4 X6 P- `% S1 r4 T
Useful breakpoint to detect it:" g% f' t0 N" e8 C9 \. x! L
/ a$ g8 I# N$ n
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, m% k0 {: c) l
% O' W, j$ T! B__________________________________________________________________________
' z. A4 p! |; n9 h
/ E4 L7 ^! c& F% X/ j* [, @8 ~, }+ `1 r
Method 14
  m* \! k  c/ |4 f* K' T' g=========
) n% w- S  Y* I, _' n7 M5 [1 W" M& ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
3 ^* ~8 U: i9 e0 P- y3 T& U7 kis to determines whether a debugger is running on your system (ring0 only)./ S& Q$ f6 Y( a3 B" m) w+ w

1 P& O/ D, P; ^) g   VMMCall Test_Debug_Installed) F, ]3 d8 `+ Z
   je      not_installed
- c5 i) |& }# p4 m) I
! c; F7 `9 z! T" q2 F3 p9 Z% sThis service just checks a flag.
" I1 T6 m# t5 S- o</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-7-25 19:43

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表