About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>9 m5 f5 ]! |6 R4 i: u- b8 d/ U5 b3 P
<TBODY>5 `- V* c, l7 D
<TR>
* P+ L- N) |1 u  ~<TD><PRE>Method 01
# H* X* H4 o: L/ ?' }& ~+ A=========( z6 V. e7 P; @  |6 {. I  N5 ?' o
! o- N" q) Q6 p3 x0 |) ]6 z9 s% h
This method of detection of SoftICE (as well as the following one) is( L' B- q) q7 ~; u3 H, {; c9 @; I
used by the majority of packers/encryptors found on Internet.3 M8 y* `& q" {+ l9 U$ p( [$ g7 w, k
It seeks the signature of BoundsChecker in SoftICE
% t  d6 B7 u! @. U2 \! v
% |" P6 w4 c. |! m6 Y5 A# ^    mov     ebp, 04243484Bh        ; 'BCHK'
9 a8 W& _1 X! h& k/ M7 Z    mov     ax, 04h
  L) |8 `! F3 I. x/ A! J; ^+ a, ]8 s    int     3      
1 j/ e7 U* f  Y9 h/ P    cmp     al,4
' K2 p5 M& T' [( A8 k9 F5 _    jnz     SoftICE_Detected/ V& S. j# a' ]* k( ?( K0 U
" J% Z! Z& k( N& C) J6 }/ J
___________________________________________________________________________
6 t" f8 [5 t# ^" n/ D: |1 |1 v7 f! h6 B3 _: P
Method 02# q# k: c0 X4 g9 K8 w5 j# l; I  F
=========
+ {4 d' J! c* J0 y  E
  }" c! Y! L- P0 V, k! @Still a method very much used (perhaps the most frequent one).  It is used0 M1 b1 R: J$ M9 w4 S
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# w% o0 x  Z3 t8 Yor execute SoftICE commands...
6 U8 B: C$ D' @It is also used to crash SoftICE and to force it to execute any commands
$ E+ g5 o0 d, }. o8 Z(HBOOT...) :-((  , Y3 n( I+ W1 R7 R, ^4 {. R

6 d. O' ^/ u7 S3 g1 D0 fHere is a quick description:
* w) F3 z6 z5 e. \7 T* X-AX = 0910h   (Display string in SIce windows)$ a: D- m; f6 U- Q" x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ ^! Q0 E* S6 |
-AX = 0912h   (Get breakpoint infos)+ E/ q7 H: S/ Q6 N. V9 C: U
-AX = 0913h   (Set Sice breakpoints)3 ~" X: Z2 u  f4 M3 ~- p) E
-AX = 0914h   (Remove SIce breakoints)
% _4 d9 a: l% ~1 H/ e5 R! n* D* H/ Q
Each time you'll meet this trick, you'll see:
0 F+ i3 ?* V. e  |-SI = 4647h1 w3 g7 y* b! z9 u, [% a% m# ^
-DI = 4A4Dh
5 E( S. O  V1 ]% H3 NWhich are the 'magic values' used by SoftIce.! j7 a  p! j  q# P8 e. k
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 m" d) o0 o5 m, P/ |- O- E, X0 a# E$ |7 R: y# T
Here is one example from the file "Haspinst.exe" which is the dongle HASP0 P) F8 }( `9 @9 `  J% L
Envelope utility use to protect DOS applications:
" I# D) H4 ^9 j+ V$ q. t4 L
# X; U8 e" y! W6 G/ c+ q: H5 q5 c$ f% N3 N8 z3 n
4C19:0095   MOV    AX,0911  ; execute command.
% a7 d! S( H  m/ P4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).' i3 p. ~* c; K% E$ |
4C19:009A   MOV    SI,4647  ; 1st magic value.
+ u8 R/ M6 a* V! \# _4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% i' p2 e% x2 ?) b9 _4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
; M, H: }# d6 D% w9 a5 p) r4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 s% d3 P) k5 l4 \% j4C19:00A4   INC    CX
3 S' t1 _5 p+ `4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* Q3 P) }# J6 e2 y8 w- o4C19:00A8   JB     0095     ; 6 different commands.
9 x0 {! k3 a1 e" t3 c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.* g! \# y: A' b0 ~$ ?
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  x( G6 j4 U. q4 N
9 |3 Q0 ]: L* j! r, t0 ^
The program will execute 6 different SIce commands located at ds:dx, which7 Q. d; `( q9 {" ^/ z  M9 c) w, D
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.4 e& d; A7 F; s  E7 |
; {) Y# D! ^# K& n6 y/ K
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 X3 Y8 A: f( S. C8 G6 j
___________________________________________________________________________9 ~: K' ^! }4 R4 B( n' y% R  `+ l! g

# M$ ?. B7 [0 U5 n+ z6 g9 n8 B+ g7 k2 b
Method 03
- F& o! d9 B0 _=========6 N$ t5 z+ e0 R. K, Y* b4 T- l
  Y% I- o0 c" `( K$ U
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ S% ]; R. Y/ y# U( W* L! X0 k# m
(API Get entry point)
. c' u" }) Y% @, F9 m9 H        # S1 X  J' X3 f, m- _* |4 l' z# o8 E

+ F& }! a+ Y! J8 C$ b# g0 |# l    xor     di,di# h  t# M* |) `* N2 g
    mov     es,di9 d4 e: `) d0 F4 L  C3 {" v8 t4 W
    mov     ax, 1684h      
# |8 S, U2 g& D+ B8 z, V. K" @/ g3 l( ]    mov     bx, 0202h       ; VxD ID of winice
- p1 S8 Y4 h' c7 D! k    int     2Fh
, T1 _- S7 k+ D' o# e6 l9 M/ N& Y; u    mov     ax, es          ; ES:DI -&gt; VxD API entry point* c% {1 h  K4 ]( e  o* S7 u+ l
    add     ax, di
0 S' g2 i  o' u    test    ax,ax) i; \) X2 N, m- Z2 u
    jnz     SoftICE_Detected- e( A8 I8 T5 Z$ {
7 W. }# K: p6 D: ~$ c9 x
___________________________________________________________________________
5 d+ h8 r, n; X& d& \# v$ F: |* o6 v8 a
Method 04
( m6 S2 U( M; L  c: `! h" x" G+ E, e$ \=========  c2 q8 K6 B! i( N
* ~  _% d4 D* `1 U, O  u
Method identical to the preceding one except that it seeks the ID of SoftICE
% n( ^+ g1 j6 ?/ D& vGFX VxD.( x1 j8 N( ^/ R8 Q0 I* \
) B8 j5 P8 o6 Y! [  q( `
    xor     di,di: S, W* U" p7 s2 e$ r
    mov     es,di
- W3 s. J: u$ Q8 {    mov     ax, 1684h      
; g# W. M4 \: s    mov     bx, 7a5Fh       ; VxD ID of SIWVID- Z; L: z- ]$ ~
    int     2fh# v0 c0 v) @& [; g) G3 ], \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 p! W! {3 a; q, Z7 C: w
    add     ax, di3 z- g) r6 Z7 p/ k8 o& {
    test    ax,ax3 b6 W, v7 r% T
    jnz     SoftICE_Detected$ |, L3 x( u) q$ a" ^8 f
' `% }6 A: ?( s
__________________________________________________________________________' c2 w! k: C, p2 m7 T$ ]1 ^
  T0 ~- b9 A4 v* G& y7 Q6 ?9 G2 A

' W' N$ L1 o' W- \: |% C3 QMethod 052 p' @6 a( Z$ P8 L+ m# g6 s9 m
=========8 S7 F& _2 ?5 q! g

- v- m, j5 Y8 W5 VMethod seeking the 'magic number' 0F386h returned (in ax) by all system/ e0 O2 E- q  g0 S
debugger. It calls the int 41h, function 4Fh." F. p2 h$ @+ q% C3 \2 f; L6 B
There are several alternatives.  
1 }/ A; I9 |: y9 w8 T1 C* ]5 I' s; N- o) R; A/ R
The following one is the simplest:
' r) `8 }3 ?2 X/ K* B) B, ]# L" L8 N) Q) K* c1 B* M0 K
    mov     ax,4fh  l+ V& X# `' _& n# k
    int     41h
9 w8 s. y. |: C" K, p    cmp     ax, 0F386
& i- ^4 D' i0 }" f# l    jz      SoftICE_detected
$ i% _7 A& K* m, l6 l/ l. J) [6 h) V8 Y% a5 ?

. v1 k1 E, N- g- b5 kNext method as well as the following one are 2 examples from Stone's
' X8 v, v: P; y5 u" w. E"stn-wid.zip" (www.cracking.net):
# p2 U# K) {0 y3 F5 `% {$ o
2 w# \1 n8 T: ^3 d& L, o3 H" f    mov     bx, cs
) C  s' \. @4 ^( N' L' V2 z    lea     dx, int41handler2
7 D: I) z4 m' b- C) W4 z    xchg    dx, es:[41h*4]
8 @% Q6 e- W1 X6 x7 F# o  c    xchg    bx, es:[41h*4+2]
& g, }" A) @9 X" }    mov     ax,4fh
: u  w. x+ z, n$ d    int     41h
+ o1 Y; ?' f. h9 x# E) P  D3 l    xchg    dx, es:[41h*4]2 a' v1 N+ d  \) {. s' ~/ [
    xchg    bx, es:[41h*4+2]
. X" @% N2 J# I1 A/ G    cmp     ax, 0f386h
( }. |1 L+ h& z( B4 I% J% y    jz      SoftICE_detected
0 `8 Q. w7 ?% w0 Z8 o* l# U. r( j2 B& }: A6 F3 w2 a, I
int41handler2 PROC! U. C/ J, ~6 G6 e
    iret
' ]3 \# K! G: u; x8 u5 Eint41handler2 ENDP
! g8 @& k1 z+ D! P% Y( C7 |8 P3 p" N0 I' k! U
8 ?% ^$ O. h6 S! v6 q3 ]
_________________________________________________________________________
5 X: [. T- p% {9 g
$ P$ T+ x5 L2 T/ q0 x1 x. M/ h# x: U8 h% r7 S8 S' }
Method 06
8 U1 K6 H7 d+ [( p2 r/ B, m4 X9 j=========
* k) I; l) k4 W, Q; v. S
, G2 m9 g  |- ?. z9 F" U/ s7 j. L6 n7 `9 z; C- X; t
2nd method similar to the preceding one but more difficult to detect:
0 `- ^; E. e: s, \  c% I8 X
9 j1 B- g- f) V0 \% X% m+ B5 o) \; r/ m* v. t0 L4 B8 t
int41handler PROC
; A# o- G* _/ `; t; x* m; X$ j    mov     cl,al" H# j% I( `# z
    iret, ~5 Z2 r/ r! x1 P
int41handler ENDP: M4 X& p$ [4 f) x' z

2 F: K4 c& T3 ], c4 B& b- }  Q! Y3 [, k
    xor     ax,ax. v5 H; @+ {" w9 m3 h6 T
    mov     es,ax/ H1 S+ z6 ^: z
    mov     bx, cs
/ t+ C8 F& e7 ^  Y/ z8 W5 _2 F    lea     dx, int41handler' @3 }" Q$ W. \. m* t; g/ Z
    xchg    dx, es:[41h*4]# Q2 ?) H' |5 b9 A: H
    xchg    bx, es:[41h*4+2]: [0 M, Y; n- v* C
    in      al, 40h
% _* m/ s* t# U, h5 i" f3 Y    xor     cx,cx
* R% l2 C; R+ L% b4 Y4 p0 [  O    int     41h, g. _# J8 A( j4 v  T/ C' b
    xchg    dx, es:[41h*4]- B4 a: ^3 t% V  }' {
    xchg    bx, es:[41h*4+2]
4 V* p( \& u9 k& G* I    cmp     cl,al
: X2 {7 F0 \0 N+ k7 k5 _, j    jnz     SoftICE_detected
- `0 b* _) I. g/ A
) d& _: u( U) z+ @! k# y3 b_________________________________________________________________________7 E1 R: m1 H  }! S% B7 @6 o  Z
: `/ J; D& z! W: h( I4 w
Method 07
$ o# P% v. w$ @0 s% a=========
/ x' c* _8 e$ ?6 S( [8 n. U
8 O. c& D) A" m$ e! ^; ?* ?Method of detection of the WinICE handler in the int68h (V86)9 w# Y9 y0 i5 L. Q( @- _3 |# T. a
* a' ~: G' }6 A2 H4 P
    mov     ah,43h  T, x/ ]: O* ~' n
    int     68h
2 X7 T) K% D1 C1 s$ F$ K3 x    cmp     ax,0F386h0 J9 d7 }5 G4 L9 [
    jz      SoftICE_Detected. m) H2 a% M" e
7 S( ]& P% i7 h" b5 D: g' u
" ]1 P( d2 l+ W
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- g! w( [9 V0 l: n
   app like this:
$ R& U& [8 d% E% S3 C0 r+ ^$ @" [" v
   BPX exec_int if ax==68
4 V1 D! @, b6 N7 `; S( T   (function called is located at byte ptr [ebp+1Dh] and client eip is# {! k7 l7 {- z. C4 K) g! Z
   located at [ebp+48h] for 32Bit apps)
4 L" v8 z. A  ?* J. e' n__________________________________________________________________________* q5 O# r, A0 [+ F% i' @
: [! ^, B, M- b6 v5 k# s0 z6 U
5 x4 _' ^  p$ h
Method 08% L5 n. j, J4 {4 x$ X. U3 m7 G
=========
# e% `7 x7 H9 h; |' d  i2 W0 f5 v& N" T9 c. w6 [
It is not a method of detection of SoftICE but a possibility to crash the* k* v6 ~0 _- K+ D& r2 u
system by intercepting int 01h and int 03h and redirecting them to another
* C. q7 y8 K' d. s# A" Uroutine.
" {2 W7 Q2 n9 U6 ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' w9 p" ?" x" ^! H9 v* U2 e0 ?
to the new routine to execute (hangs computer...)
8 ]& E, {4 w& |# s" v* [: k3 ?6 t4 A+ c2 ^
    mov     ah, 25h
% H! _$ c2 M/ ?6 p, C    mov     al, Int_Number (01h or 03h)! l% o7 J6 Z- z. [6 y- a
    mov     dx, offset New_Int_Routine
2 D/ t4 E  K# Z+ C: Q% _0 l' s; [    int     21h9 i# G6 y4 U4 u6 R
$ {6 c, p' R0 W7 [
__________________________________________________________________________. m* i* k& a1 P$ z. c7 ~6 z( j- k
( B- Z6 t7 E3 H0 V+ x& b6 V7 H
Method 09% P* g; A- `& e  c, {0 n
=========& b2 _3 u+ e. I% x3 M) R

7 ]7 w. Z  l0 S* W: k, FThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ G1 }+ P/ K, t. Wperformed in ring0 (VxD or a ring3 app using the VxdCall).
5 m6 g9 u. K+ I0 ^$ TThe Get_DDB service is used to determine whether or not a VxD is installed
! ~, W" n: ^" n8 rfor the specified device and returns a Device Description Block (in ecx) for" P8 _. g) S2 M/ l  O' I
that device if it is installed.
+ o+ R+ k% m/ l
. q% D+ \& f% f- R   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  G" ?8 K+ W1 {  _0 s, `* S! S" O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* G& @4 {% t2 }% n# m( z) ]
   VMMCall Get_DDB2 ?2 O& _, l. y' ]6 T4 {6 s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 u0 I% |8 N1 b: {& G6 L4 l
: R* I- E- r  w- @1 N; o
Note as well that you can easily detect this method with SoftICE:9 |$ A$ W2 z( }8 |6 t6 z
   bpx Get_DDB if ax==0202 || ax==7a5fh
* ^  h: N, @0 d. t8 ]& x
" Q. T- _6 b) g1 L( z$ r__________________________________________________________________________. W0 j) f$ _0 j6 r  n
% X( g  M) _. Y$ i& y' ^9 @
Method 109 u1 i; e5 l3 s
=========# z: P/ X7 O9 q
0 A7 n1 C1 \. h+ |! N
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 W4 w* r# o5 @* g) d
  SoftICE while the option is enable!!( ?' @* D# N8 v" x7 `
' O5 e' B  z  q1 W
This trick is very efficient:
+ y! n7 T& {3 y* w% [+ _$ Oby checking the Debug Registers, you can detect if SoftICE is loaded# m" m% l8 t6 i' D: B% Q+ `
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 ~  ?& t5 m, i1 \* d
there are some memory breakpoints set (dr0 to dr3) simply by reading their
  w) M& t" w% ^( kvalue (in ring0 only). Values can be manipulated and or changed as well
, |; g% g2 R4 O. p  ?5 g3 h2 y) h0 U: S(clearing BPMs for instance)  I9 D! {% U+ t, I- ^4 ^0 L- c
; I, s: [& y  c: K  }
__________________________________________________________________________# g$ g( C9 S7 R

( r" G' J. ]! L- |Method 119 i# A& S4 h/ d- A" O9 U
=========
! Z! [% E5 {+ F+ k0 d" ^" q# A, f' \1 J' V& ]. N
This method is most known as 'MeltICE' because it has been freely distributed; Z6 F, i9 i; {$ b
via www.winfiles.com. However it was first used by NuMega people to allow
  j. L4 p8 p" N9 i4 hSymbol Loader to check if SoftICE was active or not (the code is located
: o  i, }# C$ minside nmtrans.dll).
) `* n2 d/ ?9 {2 s7 j
4 s1 o: l: n+ U+ LThe way it works is very simple:" L3 e: |7 _' L) ]% m8 P9 _( \
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; @5 A6 F8 U) MWinNT) with the CreateFileA API.3 l8 f- x# E2 }. U, h
. t) p' Q0 ^" h( Q9 U% y9 T
Here is a sample (checking for 'SICE'):; H3 M9 q) x$ V" z7 y7 L) e
3 M3 U2 ~1 w. r
BOOL IsSoftIce95Loaded(): Y$ g$ l* c; t$ p( T% ]+ r
{# Q8 B2 v' J& t  M; I  j, l9 O
   HANDLE hFile;  
$ z( ]% N* t* T) f$ C6 `/ G   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; L: |$ }/ @6 G
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( e8 L7 h$ i/ b  Y! T$ t% T8 o                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 P: [& K$ d: h& E
   if( hFile != INVALID_HANDLE_VALUE )$ Z+ `) r6 d' j* h4 x) [: {
   {4 b" ~9 q) T! A  [
      CloseHandle(hFile);* h2 e6 \7 s& k9 a" t
      return TRUE;+ T# X) l2 a& H9 o! Z
   }0 I0 f$ w# o+ b" X4 T# x
   return FALSE;
5 S1 f5 _5 m8 ]# C! p}
) c5 b6 K. |- }9 G  E, K, [3 k/ |, ?; K. E1 q3 c9 q7 i
Although this trick calls the CreateFileA function, don't even expect to be; N; ^8 `% p' c# A6 t
able to intercept it by installing a IFS hook: it will not work, no way!0 {& a! f4 e2 |2 g' i/ J+ S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 @5 x8 U/ }4 M$ t" ^2 n) zservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# ?  V6 `# d7 H& a4 t
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ n% T5 Z$ u% _/ I: U: ^! nfield.
  `, ~% q) R: u7 oIn fact, its purpose is not to load/unload VxDs but only to send a
( x8 L( D9 {6 o/ K* U; f9 `* S" cW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( ^! Y1 B2 N) m9 v8 h$ S  e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 a+ U% ]. q& [. Z1 c4 \1 n( fto load/unload a non-dynamically loadable driver such as SoftICE ;-).
, w8 D1 j1 H7 t+ v- zIf the VxD is loaded, it will always clear eax and the Carry flag to allow  K1 i& N9 K5 M
its handle to be opened and then, will be detected.
) q! E  m- }/ h. J- _* P; c: [You can check that simply by hooking Winice.exe control proc entry point
7 k+ m, ]9 l7 S8 B8 v# K9 {* i6 jwhile running MeltICE., j' |8 N/ m+ f3 W+ u0 P

$ z3 _8 I( n; q# R' e: g% U5 R( Z+ [. I% Z' f& j$ p7 s
  00401067:  push      00402025    ; \\.\SICE
! r6 {. A+ @6 U; g  0040106C:  call      CreateFileA+ ~* @& Y5 P& h' x7 A2 m
  00401071:  cmp       eax,-001  @% {3 H% z1 O$ N" x  J
  00401074:  je        004010911 V1 [2 \7 c* S5 v9 n

; ]; O0 w) R% s& Z" F, M% \5 i( J# a' Q8 w
There could be hundreds of BPX you could use to detect this trick.
5 f1 b, m( g3 ^, C, }- X# {# f-The most classical one is:& p* G9 L! x" T7 [+ Q2 \) |" _
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
" k. {8 c: i4 v    *(esp-&gt;4+4)=='NTIC'
$ Z0 c- o4 C. }# G+ V4 K* U$ ]. g/ U# S7 N( l' r. s
-The most exotic ones (could be very slooooow :-(
1 l2 A  `) S; c7 [+ l   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & d/ @- y4 ~, O! f: E: F/ q& }
     ;will break 3 times :-(
: ^# O: `1 b9 h: k% ]2 f2 g# _, a/ E# }  Z  a" W
-or (a bit) faster:   C0 U. Q1 k* a! n% {0 X. ?
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ f3 H# e. ~* |' z+ J. |
$ @" n# b5 W8 ^  z9 P. p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 B# T) T1 I$ X' c. A; J# W# F
     ;will break 3 times :-($ X- @6 i9 T( H6 o6 \

( C( m! h5 x# E: W% j& P+ m- \. H-Much faster:
) k0 x$ C% h& V1 U) O   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
+ [3 u; d0 D* }- H8 X9 ~! n* R: H, ]+ w
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen1 r' E- Y' Y# ?6 [4 k
function to do the same job:# e! V6 s8 t7 R: N3 ~0 U: W; ]4 k
' [5 x+ y  U! k% H% ]# C
   push    00                        ; OF_READ
1 T( V2 @' u+ [   mov     eax,[00656634]            ; '\\.\SICE',0
, {$ Q& R2 n+ v* i/ E/ I' a7 I/ X, F   push    eax4 ~- x9 G& N: ^9 W- @" [2 |  z$ P
   call    KERNEL32!_lopen  ?4 N% [  P, ]2 W' n) i
   inc     eax, @0 r; s3 e/ x( @- C$ H
   jnz     00650589                  ; detected5 e5 |7 _$ D# w. z) w
   push    00                        ; OF_READ& g' w* ~+ ~3 t  _5 y
   mov     eax,[00656638]            ; '\\.\SICE'
9 o4 u+ F* s; [0 }8 n1 X* i   push    eax
- j  i3 o2 P, r( ]   call    KERNEL32!_lopen( O/ @1 y. L. Z  w: H
   inc     eax' _0 E9 B9 t6 N2 d+ P4 F( Z
   jz      006505ae                  ; not detected: v. a9 g& G" J) Q- X4 _1 \
  I! r4 |* Y4 C" X5 x# t
' X+ b- \! C) y7 [( A
__________________________________________________________________________! _/ X/ M" U5 {8 F
+ |8 _* G3 v, o/ T
Method 12
0 n2 j$ M- l" L! Y* G7 P=========
. u  B! d& [8 e( }: C, ?& X
* K* {# j6 {) P2 h5 M# v" X; k5 `2 CThis trick is similar to int41h/4fh Debugger installation check (code 05
  M: _6 z. X" ?2 k4 ]&amp; 06) but very limited because it's only available for Win95/98 (not NT)
+ g1 {. Z6 J1 J+ fas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" T& |: j* T  n; J
/ H8 J9 [0 F: y. F   push  0000004fh         ; function 4fh5 [$ A/ f) D6 N- u% a% g, U
   push  002a002ah         ; high word specifies which VxD (VWIN32)
: k) }! o. ^7 {% q% V                           ; low word specifies which service2 m( w" [- z/ @$ \1 c6 x, J: D
                             (VWIN32_Int41Dispatch)
. ?5 h4 U+ f: R6 i. D% p& ~   call  Kernel32!ORD_001  ; VxdCall
4 v  _4 n7 k( \: I  M0 R, B+ l   cmp   ax, 0f386h        ; magic number returned by system debuggers/ r! q0 e  r& ]- P. ]
   jz    SoftICE_detected. y7 m4 A. L$ T! ^7 l  j+ {5 m& ~# }
3 [& O$ q# \0 v) r, I# H* Y  `
Here again, several ways to detect it:! n0 v0 i8 l  R, X3 T. x
1 H% M# v$ J+ d9 L3 r( o4 `
    BPINT 41 if ax==4f
+ x" s4 }  A5 r- k
# g& G& W3 z, f2 N8 N1 P" e0 T: f' i    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
% O( d# @! m( y
; o, u+ D9 ^) L$ O& P- w* N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A9 s. ~1 h! X" p5 S

: {0 A* c' {9 H# g' ^  n    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 Q- L5 e, z" b; H: s! P& D

% D. T: a6 n$ K" k, M; i2 W0 @2 @* q& B__________________________________________________________________________
) ~2 a% X# L; ?# u) G% e. _9 I8 d% k6 w, V
Method 13
3 m* [5 H! O; A3 z=========' X2 B1 i( d. w6 h+ |0 k
/ o3 |9 O# ]+ M% x
Not a real method of detection, but a good way to know if SoftICE is5 C  o% r+ D" Y" @) h8 Q* Z
installed on a computer and to locate its installation directory.
$ I" L9 s; V9 R. i. H: vIt is used by few softs which access the following registry keys (usually #2) :
. n2 x7 I' o5 i  Z9 {
8 h5 \6 F# |$ a+ o-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ l; [; N, p+ w* R; D8 }* R/ X/ l
\Uninstall\SoftICE, N- R4 J( S$ h7 [  V2 J
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
9 h4 m; D( T* ?; \% c. ^! _-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) a0 L1 N: s% h  R+ f
\App Paths\Loader32.Exe5 }% r' I+ H- z; a: y3 y' W
$ ?! X$ I7 l7 \
4 d9 `. ~. m/ R5 v+ q3 R
Note that some nasty apps could then erase all files from SoftICE directory
# G+ Q" c( P: v- d- b. c4 r6 Y4 B5 ~(I faced that once :-(
6 d1 g- J, r/ f4 G  ]" \/ t" A- j- s- j
Useful breakpoint to detect it:
5 k. ]4 \2 A  p5 X; R
! e: ]$ m/ o$ N6 H& n     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
8 f' C8 G1 X$ ?; W8 {2 o. _& n1 B/ Y$ x# [8 h- L. e& H  S
__________________________________________________________________________) [" ?9 _) c4 m2 I6 u: B0 n

7 S- C3 e* p3 E
" h1 @1 S) h2 zMethod 14 7 h/ }& U5 `: [1 w6 S
=========; }# D: M/ e4 c% C* Y
; L7 Q% e0 ]; Q8 i
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, d* j8 C; f3 K4 r/ y
is to determines whether a debugger is running on your system (ring0 only).) k1 G& [+ G/ ^' g6 V3 _

( E3 ~% W8 U* N: k3 m& p0 v9 Y! C   VMMCall Test_Debug_Installed
& Z5 o# u+ ^" @( @8 v$ O3 E   je      not_installed
6 W- m7 {, q0 D8 ]& L# z# I, N# W( q
This service just checks a flag.
3 d! T' |" {; b2 g</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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