找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& n6 ]/ i& Z0 a. {2 r, a<TBODY>
: Y2 }4 g6 J0 U<TR>6 k4 |' w2 U& B
<TD><PRE>Method 01 + H2 l. n) n" F2 L0 [: ~/ y
=========
  I) b7 t' n4 x4 C/ O8 s* S" m1 R# X; U4 X0 [
This method of detection of SoftICE (as well as the following one) is
0 l  B' f) }! a* V% o1 R% x' Q8 Nused by the majority of packers/encryptors found on Internet./ q- `2 D0 L/ p# [, X
It seeks the signature of BoundsChecker in SoftICE
5 p' I9 O8 w! D# d% b1 Y
, y; n1 k  h* g+ ?9 W) s5 f0 x) q    mov     ebp, 04243484Bh        ; 'BCHK'
. a2 u6 [: ^- C  v( l$ B% W& v. Z    mov     ax, 04h
. i3 I. }; |; K: T. D' _; G    int     3       ; W4 Y6 o- @. H% s
    cmp     al,4% F2 y1 u; q( O& ?1 H
    jnz     SoftICE_Detected
9 y3 f9 Y- l$ C3 K  f- p# K+ l# S& l+ M! v- I5 j
___________________________________________________________________________$ y7 R4 O# f1 e; @: \1 J$ d. U2 R0 `: I
1 i  Q- O- X" b( b. p  d
Method 02
3 ?: s3 L: P6 a# g7 j* B=========) h* {4 o, Z4 \0 V
! M) `' N% ?( C! C% T
Still a method very much used (perhaps the most frequent one).  It is used
8 S0 `/ r' t$ Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints," A: z$ M# Y. q2 G' E
or execute SoftICE commands...( o: k1 ?6 m2 Q0 n
It is also used to crash SoftICE and to force it to execute any commands" Y+ A0 d' o* a$ g
(HBOOT...) :-((  " v3 [; q2 g- y1 A8 ]/ K; c9 B
, {( g  X6 F* g$ w6 a
Here is a quick description:4 n' n" ?) x% x$ {9 G9 `  b
-AX = 0910h   (Display string in SIce windows)
" }4 G. _  ~, _-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)0 S( o$ K1 E/ D5 E
-AX = 0912h   (Get breakpoint infos)
& Z: r3 e( I8 d-AX = 0913h   (Set Sice breakpoints)! z. m" I5 {* ^* t( E9 C# g
-AX = 0914h   (Remove SIce breakoints)
8 A) D- [4 Z2 i. V9 q
/ g& K% n6 r2 ~4 }  H  {6 |Each time you'll meet this trick, you'll see:+ r# w8 u  Y% i* C: Q/ Q
-SI = 4647h
: @: V$ ~2 F. p, y$ h2 a) H-DI = 4A4Dh
) J2 z+ p9 a8 b" T* M0 a# eWhich are the 'magic values' used by SoftIce.! \; C! Z6 t  v( |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 }: c# C+ _+ Q4 o  ?
0 n" \0 D, P) I
Here is one example from the file "Haspinst.exe" which is the dongle HASP: E, B" r6 A5 D2 k* |5 |" r. [
Envelope utility use to protect DOS applications:2 V0 @3 h6 u2 a: c2 ~" p! f6 ^5 W1 Q
/ m' G' K, V6 N6 j" z: c* ?' d% }. T

, o8 W# U8 x# ~: F$ u4C19:0095   MOV    AX,0911  ; execute command.7 u2 f+ U$ i0 f# }, i. R
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! x3 K& D9 x! V( f- s1 i4C19:009A   MOV    SI,4647  ; 1st magic value.; k& `8 J# n' _; }
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ F& K) Y% E2 q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)7 Z" @; w- j8 a' E3 q; x! s6 h
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute: s$ s. T0 j4 [+ }: s
4C19:00A4   INC    CX
0 M, N( _  G* b. u% ?8 ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, {2 W% b0 i' Y7 g' m4C19:00A8   JB     0095     ; 6 different commands.
8 K) p" K/ }$ W7 M2 k, k* }4C19:00AA   JMP    0002     ; Bad_Guy jmp back.3 C6 V( |, M% \/ B7 {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
  K# M( W; x* X. a& |: ^3 c, ~: r# a8 I1 s
The program will execute 6 different SIce commands located at ds:dx, which
; E  ?# u! m1 h3 `2 }( [/ Bare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
5 _6 e+ Y( |! z1 N6 p# T4 e; R! Q  k- ?: G. e0 ]
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 X' `3 w1 f' `& k: `___________________________________________________________________________
0 V. n4 s4 j# Q5 q0 b4 S7 L/ a& B! x6 ~7 C
: o  X+ X1 a  h9 }
Method 03
! N# w) Y  G8 t2 A+ _. z* k' {=========) [" }, n  }6 R4 C
" E7 h+ B% P- j5 f; V5 s
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 m7 n+ G9 f' e# \6 P8 b6 O' o
(API Get entry point)0 c& b& R  k! H! j( e+ N
        ; F# v/ {* ?+ G4 b3 h
" g+ q3 H! g  q; B
    xor     di,di! k7 r6 l. E6 ?2 T9 \5 E
    mov     es,di; z1 Z7 u1 _0 ~5 Y
    mov     ax, 1684h      
6 Q) a6 q% D* v6 k    mov     bx, 0202h       ; VxD ID of winice& V8 ^2 e! b; \
    int     2Fh
3 u9 Z- W8 q9 H) {5 d6 U    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 C6 f! P0 d. b( D; a+ T
    add     ax, di
% ^# \8 z% T3 `7 D8 s% \    test    ax,ax
+ F0 t4 k; N8 ~: P' N    jnz     SoftICE_Detected
; a, j9 @: g2 P7 k9 j/ W
  f8 \& O: p/ v+ @1 N: k___________________________________________________________________________
  i/ n* {( |2 P9 Y; _7 G7 @  G7 i1 u6 a* e# S% [
Method 04$ S- R8 {+ @8 d
=========
9 l! L2 Y, q, k2 W: f/ j
2 u6 y  y0 t2 j! q' A9 qMethod identical to the preceding one except that it seeks the ID of SoftICE
$ u* P, R3 v8 p2 K& r; U/ ?+ w0 ?GFX VxD.
* q9 V; j; e1 U
" i$ A8 s( G: f1 v! S/ q6 h+ F    xor     di,di. W  E( g5 j6 ]2 }) V
    mov     es,di6 n( g5 B6 k2 E
    mov     ax, 1684h      
; P- K. m( w6 O0 j6 h# a3 X    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 _9 X: K8 X6 K8 z) w
    int     2fh
, Q, @4 o/ |: k  k    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- h4 I6 u& U6 |8 A+ e; U    add     ax, di+ w# r4 D; ~! p* W! `& @
    test    ax,ax
3 H& o1 D2 @9 B% y    jnz     SoftICE_Detected
7 ^$ j  `# p0 t7 j! m. ?2 e: T  u! J1 H
__________________________________________________________________________
! X* Y9 {0 j" @1 B# X5 C2 f
/ u7 G9 S' q& M. ?8 x* O# B; P# ~
5 C, U( w# Y& `+ DMethod 05
# t; z: {4 Q2 ]( F( u/ Z' B=========
# O% d; M3 C+ ?( `
  `4 n* s, S& @3 A8 eMethod seeking the 'magic number' 0F386h returned (in ax) by all system
) A% ?7 J" y/ Ldebugger. It calls the int 41h, function 4Fh.
4 t) D* T* I( _: t6 r+ _) LThere are several alternatives.  
& ^6 c5 D$ j6 f7 n1 T! A+ ^4 ?. X3 b2 z; k
The following one is the simplest:7 L- y) X$ ]' X2 k! L; Y1 j  K
) e8 F0 @' ?! |
    mov     ax,4fh( y8 m8 s+ H, Q9 V
    int     41h# g/ I1 t8 x9 C  f( ^7 w4 O
    cmp     ax, 0F386" G8 U6 f0 X& @+ M8 Q: ~, N8 z
    jz      SoftICE_detected0 N: Q" U) B" y; N3 C" v# p' V

: {4 ~/ U& T1 m" C8 g* K6 [2 G1 F6 M% ^4 G% T! o% k" M0 {
Next method as well as the following one are 2 examples from Stone's 1 D7 N, G7 `0 X+ {
"stn-wid.zip" (www.cracking.net):8 D$ c. _0 e9 h2 L4 e

5 n( O. [7 Z4 e    mov     bx, cs- `: c0 y( u8 M1 r' O
    lea     dx, int41handler2
# p5 T+ R) I1 b$ m+ j1 u* n    xchg    dx, es:[41h*4]( A# x: V! i* H( n  I: X$ t# u
    xchg    bx, es:[41h*4+2]
8 l1 E# F+ Z! D) ]* P0 c# ?# w    mov     ax,4fh
/ m' A/ k+ k( I$ g; ~    int     41h
0 Q# b. }8 Q- [7 P' A9 [4 g' l    xchg    dx, es:[41h*4]; X5 p; h8 _1 ^& n; R5 O, b# F% s
    xchg    bx, es:[41h*4+2]
$ p8 d) q: Q' e* `5 @# I: J    cmp     ax, 0f386h
7 I" Y' B$ E& ^. a5 Y: H! r    jz      SoftICE_detected
: J4 D6 g( n9 V: r6 a- k" k$ D8 r
int41handler2 PROC2 u9 A, N1 O$ w) U( C
    iret4 N: c# z) q2 @! D
int41handler2 ENDP: u  S! w' k4 u: o

/ j1 z9 M9 i5 e# Y
* D$ @/ w& J9 g0 F3 Y% g0 Y" K_________________________________________________________________________
* y/ @+ p4 n: I$ [- H: H. F4 b3 c9 V! m) o
! `% l/ K, H' [* e0 g: t
Method 066 `. p# j$ B. Y; N0 V' j& C% L: ]
=========
7 |$ _6 V: p' M% t& e. }( n9 B+ }6 F, H- h  _/ l

& s* [5 S( ]- X  y2nd method similar to the preceding one but more difficult to detect:
- R: K' j& p  |" t+ _  j# n1 w6 b4 \, N) u$ Q1 y, h

- M; o: y2 }8 T, ]int41handler PROC" R: m) N' z0 f1 a/ E) s! m/ f
    mov     cl,al7 `( T# C7 w' {5 N- y) \& k
    iret3 l, I. H4 n1 c8 W  V, U6 Q
int41handler ENDP
' o* N' n, c* d5 _4 b
: l+ Z* Z3 w2 A& b- o. L- p
$ ]% A% w0 R- W! z( u$ w    xor     ax,ax
1 F% f5 V- U3 C7 K3 Q    mov     es,ax
6 Y( ]; k6 g2 ?# ^    mov     bx, cs
& a; b6 d- p0 `& T' c6 q4 f& b$ \    lea     dx, int41handler1 Z( F! E  h2 O; d0 Y  k* s" @
    xchg    dx, es:[41h*4]
( N3 O7 d: s. K1 D4 a5 t/ V3 L6 v3 q    xchg    bx, es:[41h*4+2]
: k3 w4 _4 Z0 h; z+ b0 N    in      al, 40h) V* c- ^1 L# }+ l% L! o
    xor     cx,cx
9 Y0 k- E6 e6 R- w    int     41h
0 T: D% F' ~+ I" P. L$ d6 ]    xchg    dx, es:[41h*4]
' j$ r3 V9 g$ U3 }4 E/ |& R    xchg    bx, es:[41h*4+2]
' T5 X2 r& I+ c8 S+ y  X" ]    cmp     cl,al& n6 T7 X, a+ T; K2 S0 E2 x- g1 E
    jnz     SoftICE_detected
) g0 Q5 o& |" v& s/ a
( S0 X- N9 l3 J! l& y; f+ r_________________________________________________________________________/ Y( }+ |5 K; r9 h/ h0 k' d

; K/ Y$ R2 M) p8 C+ {0 ZMethod 07
0 v1 E0 s% n( h=========* e3 T: T0 X2 B% j3 R; S

" B$ ^9 f% ]4 w' n) u$ Q  sMethod of detection of the WinICE handler in the int68h (V86)
" q4 g5 k4 ]4 [- ?
1 J& {- z6 P7 l7 X8 [    mov     ah,43h
3 d- h# n7 q/ ~2 b9 w    int     68h
1 h- x! m" L7 f4 m    cmp     ax,0F386h
' ?! r  E- t( f# T4 S/ v% p    jz      SoftICE_Detected7 V$ h% B8 s0 m' M3 E+ J1 s

2 v: H1 `7 q6 Y2 L7 k: R
; |$ h' e/ G1 e# U0 ]- z! e9 R. I4 Z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
% Q+ K5 V! ~) C! l) v# E/ \5 P0 r   app like this:+ U. q! I5 t" Q  A" G) C2 Q
0 D7 e% @: X6 `% @
   BPX exec_int if ax==68/ j1 e% F! m4 e4 W# u
   (function called is located at byte ptr [ebp+1Dh] and client eip is: ^. ~8 ]& \( L% M4 l, w/ f
   located at [ebp+48h] for 32Bit apps)
. H; J4 Z8 i5 k% G' a__________________________________________________________________________  j! L: I; Z) T# R- j& P
: v9 h) Y9 [3 v6 c

: P) P, x7 n8 G- [Method 08+ ?* i! L$ r2 N1 [
=========
1 [. s) c1 F) V6 F' O1 b4 }; J6 Q7 Y9 s. y
It is not a method of detection of SoftICE but a possibility to crash the
0 W/ A. l0 |" v- y% lsystem by intercepting int 01h and int 03h and redirecting them to another
* c' F! Q5 q' Lroutine.2 ?( m' A; q$ e' B- o6 U4 a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, e2 b+ l# \6 C. kto the new routine to execute (hangs computer...)7 v& k. e! O2 w* J( S( q- L
" z8 D/ L- h4 c  k, Y- n$ }& u
    mov     ah, 25h; G0 h0 `6 F, F0 {
    mov     al, Int_Number (01h or 03h)1 h9 _% |$ G% {7 _4 w% i: N
    mov     dx, offset New_Int_Routine/ a: M! S% o  u" a2 V  b
    int     21h
& ^0 u# Y/ c$ y7 t5 t( t) ^+ y3 x+ d2 `% H( F. {, d
__________________________________________________________________________: F$ d7 a5 B( A+ f

7 j  i0 h; K. L7 V8 L* W; x5 MMethod 09
3 D( i2 L) n$ n& b0 w" a=========) l; h7 e4 Y+ D
- E/ ?1 o& l$ f, l, q  L' B
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& z6 `: s. A: e  p1 T
performed in ring0 (VxD or a ring3 app using the VxdCall).$ E2 x2 p9 J7 K  W( H. `
The Get_DDB service is used to determine whether or not a VxD is installed
+ K- x2 U3 d9 F2 l0 e  v2 Sfor the specified device and returns a Device Description Block (in ecx) for
* X- O) D' U! p1 j2 fthat device if it is installed.
/ o1 q9 J5 r& Y' Q: e" K3 ~
& p0 X8 P- i' P" t4 d- v" T5 X   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; Q/ }! T% L) G   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)7 x* o) \/ _+ ^( I- k
   VMMCall Get_DDB* X! s; E( M  j6 v0 Q2 h6 a/ y
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# C6 \5 a/ g5 Q, n: S2 }0 n

4 h3 R3 i1 U+ CNote as well that you can easily detect this method with SoftICE:  [/ J, N5 B2 @9 q( ?% A  I7 [
   bpx Get_DDB if ax==0202 || ax==7a5fh
! m( K9 N- ]; ^) S5 J7 A
5 b& W' @. }  ?( C$ t5 g__________________________________________________________________________
* D6 W' |8 i  c: q& j' c. f5 T1 v$ L( P: r' L
Method 10  @1 d/ X9 N- @& z# e$ j/ s. N0 L! R8 \. n
=========
- Q( H  f' c8 r6 Z8 t8 m
( J) P/ K* N" y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ e+ c: I$ t0 h7 J3 G, w) a  SoftICE while the option is enable!!& X8 E5 Z6 i* ~/ W$ i7 ^/ U

) Y1 d+ ?8 x( g- k% xThis trick is very efficient:
, D( z. m+ A. _by checking the Debug Registers, you can detect if SoftICE is loaded  r# P! z  y( X( k
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, A0 o# [. |& i: C( F, H8 P* O. v. c
there are some memory breakpoints set (dr0 to dr3) simply by reading their' o+ m8 ^: B9 k' t6 R
value (in ring0 only). Values can be manipulated and or changed as well5 P0 E- Y8 t& }. x9 ^
(clearing BPMs for instance)1 n, d9 S; n4 K2 L

$ Q  m! t& V, U: ?) Z( r__________________________________________________________________________
- h* C( x& z4 ?# D/ {2 t1 r; l! [/ J8 \
/ Z7 K, _0 u( ~& {Method 115 S$ l) C9 u! z8 M
=========
# k# q* B; O2 K# |! \( o. ^& x. a& V; U  I
This method is most known as 'MeltICE' because it has been freely distributed; w+ c; H6 L( _$ R
via www.winfiles.com. However it was first used by NuMega people to allow' l) Q' m5 E7 m. D# r
Symbol Loader to check if SoftICE was active or not (the code is located
' H$ d2 q0 K, T  b, o. Dinside nmtrans.dll).
6 s$ @+ D2 L: k+ m( o+ p
+ v  a" [3 D# ?8 Q( m" NThe way it works is very simple:8 }# U! m* J3 x; b
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& }& G$ [; M- C8 Z8 l8 Y# vWinNT) with the CreateFileA API.7 g8 t, {7 g6 D( ]. E& B% {
( n- O4 I# v, z( l# I$ [  h
Here is a sample (checking for 'SICE'):! F! B; o6 V! E1 o& B
* C3 u' e9 F& e
BOOL IsSoftIce95Loaded()
0 a' E  Z2 ?% G6 [6 S{( Y' T! q0 n+ J+ @7 V. Y
   HANDLE hFile;  
" d# w* h$ l; t) m: I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  d8 \3 l: w/ O: n& ?$ m" ?
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- V8 r, G) b0 }3 O: W                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);+ {; d! `' t" H+ Y5 L6 A$ J# D
   if( hFile != INVALID_HANDLE_VALUE )9 m2 K& X+ K2 _9 M. B
   {/ W1 j$ A- n! `; j5 h$ l2 R
      CloseHandle(hFile);0 q% Y; U0 s; w9 m' P
      return TRUE;& `4 D1 W( v  B$ h
   }
. J1 f0 D3 {' Q% r0 l+ G4 j) V) J; l   return FALSE;8 B, L7 H& n9 y; m4 F3 Y
}0 Z3 V0 ?* i) L( m. g2 {' w6 `0 `
5 N( n: S( F# N1 b
Although this trick calls the CreateFileA function, don't even expect to be
6 E+ G9 g% o" m8 f0 ^/ Rable to intercept it by installing a IFS hook: it will not work, no way!! a( @. X$ ^& a# l' f/ R
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; O1 }! s0 i( Z/ j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 \9 H& ?/ @) P  w$ f0 W
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 d! ~' r! A4 @$ W0 mfield., A5 J/ z  u# s0 c/ K
In fact, its purpose is not to load/unload VxDs but only to send a   z9 N  z) \9 k" F: g& O2 U& D
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); ]. d- ]2 O* j/ D8 w
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
5 F; Q& B% y' R: q' Jto load/unload a non-dynamically loadable driver such as SoftICE ;-).( @- g3 d7 h0 _# `
If the VxD is loaded, it will always clear eax and the Carry flag to allow: ?3 d3 {  Z' t; r
its handle to be opened and then, will be detected.
! p, _3 D/ i0 a; a8 ZYou can check that simply by hooking Winice.exe control proc entry point
; M, b! G# D7 k. \while running MeltICE.
$ g: L& T: [  }/ R0 l6 a! T2 S- r) }$ K+ K8 p  @1 I# `( f

8 H& r* ~% ^$ r  00401067:  push      00402025    ; \\.\SICE' \' m4 y% X) W4 x" b: q9 a/ ~
  0040106C:  call      CreateFileA4 {( L$ k* y, C4 i+ d4 M* u9 Q
  00401071:  cmp       eax,-001
, I5 g$ U. \$ [( Q/ Z1 M4 M  00401074:  je        00401091, G: v' O# @/ `* y& l' F

% p* K( s9 B. g$ w8 Y& b% D* h" v6 o- `
There could be hundreds of BPX you could use to detect this trick.
7 s# r+ ^. h3 ?7 t  Y3 ?-The most classical one is:2 [8 x. F1 x5 X. I. m( t7 s& H
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, j% ]; z. {) z, W4 [- ]    *(esp-&gt;4+4)=='NTIC'
2 W" O: x) w# _) {2 a5 a2 Z
" @7 ?, w$ t% `( O1 m-The most exotic ones (could be very slooooow :-(
8 o. ?$ V0 r' o1 q3 O2 c8 f& T" @9 E; `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 A7 k  a' w; P' q0 B     ;will break 3 times :-(
) n& d7 d3 v& i2 L$ @! `5 I6 j' i" C) T% K/ U6 N
-or (a bit) faster:
. O* V% k/ c$ M   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 {! e  K: V: [1 S: T

' R8 U% \% {+ s: ?8 ~   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: P% J1 k+ T( i$ c3 f) o" z     ;will break 3 times :-(
1 V5 N8 Z+ V. n7 `4 O" Q# _! K
4 V7 E2 ]7 R. h7 \7 {-Much faster:
  D2 L6 N% S: Y5 q6 f. I& [- D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'' t* ]. [8 ]! t; @. r, U) c' j4 g& H
( |* U$ w* x8 H5 Y3 x
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen* u* p8 v3 L6 n
function to do the same job:, E  j5 z- x4 w

3 Q$ Q) G5 `) Y& W* U7 U   push    00                        ; OF_READ
6 y& |+ g8 v' S" |/ g   mov     eax,[00656634]            ; '\\.\SICE',0
& h# l8 A% Q) j% I+ L   push    eax
" _, M& w0 u- \) H! Z: d   call    KERNEL32!_lopen; s: A; t+ ~7 @1 g4 }# d0 S5 x  S& H
   inc     eax' ~  p" c6 b3 b3 Q* Q- Q
   jnz     00650589                  ; detected7 h1 D! J, ~. C  F
   push    00                        ; OF_READ+ Z' }# C: l# P' ^
   mov     eax,[00656638]            ; '\\.\SICE'
7 p2 d+ [& B2 u8 E   push    eax; D' x- _3 w5 R0 M* z) z1 Z
   call    KERNEL32!_lopen9 y, d  }# \: h# Q; S5 B  l5 ~
   inc     eax
6 V5 x4 f2 z0 Q# h. a  u   jz      006505ae                  ; not detected* y: `+ T, ]% \9 L
7 W% W$ Q& o( x1 ^) |4 }) ^

2 E$ }) z# {  `6 {# ?* e/ [__________________________________________________________________________
! C0 y' P, v; F5 `! n1 Z6 W. s9 f: b9 o9 F  K/ X
Method 12, N$ q- \6 n0 a7 A3 h
=========
1 ^& }- g/ o, d( r% }* M( ]& k7 T' {* W
This trick is similar to int41h/4fh Debugger installation check (code 053 A- A; L+ G! G5 V; p; O3 `; U' Q% ~
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 n. V7 ^3 D- ]as it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 _8 |4 P! M( I
" v, Q4 f, ^0 R/ M! j+ Q  y% W
   push  0000004fh         ; function 4fh7 x8 h- @- z& g
   push  002a002ah         ; high word specifies which VxD (VWIN32)
; \' P1 H: |3 _& U3 o+ n                           ; low word specifies which service% D7 ?$ o" z' Q- i
                             (VWIN32_Int41Dispatch)4 k1 X+ t, x1 z" U" f- A) E: r
   call  Kernel32!ORD_001  ; VxdCall
. q8 O" `; k9 D. I5 o) m6 c6 b   cmp   ax, 0f386h        ; magic number returned by system debuggers
1 W& n/ _, x" ?   jz    SoftICE_detected
# T# c! @5 r+ e2 W; l% k
+ w) F* p- i. m' Y* h& VHere again, several ways to detect it:* U2 l7 [% m# p% P( m( P8 F
2 V6 A6 z6 U; X1 N! F, a
    BPINT 41 if ax==4f
- Z: g; `0 h8 L% V" U) H7 r% X- r& Z. c1 G
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 m9 W. D0 i4 W- g- R4 u; v$ R2 X
: ]( y5 M( C2 b: G& m    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 l# W! O, q. e

4 x5 ?2 V% k% F! Z- x  v    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; \7 k4 }4 t. ^1 [. C/ A. r" b5 D
, r+ G# ?: _( T6 |; a" _4 T__________________________________________________________________________+ P/ i: l& U+ D/ x1 n

  X6 c8 A6 x# M+ F" B1 ]$ j) {Method 13
  P# O, \1 J1 A6 g$ Z=========
* y0 t5 i3 O; V3 Z9 C6 f& S9 X2 ^1 O
+ S6 W8 r. }+ w; U$ t( T# X( vNot a real method of detection, but a good way to know if SoftICE is$ N, T& ^. A" a& w( y) k# D3 B3 L
installed on a computer and to locate its installation directory.; ~( S- m* |+ M( c
It is used by few softs which access the following registry keys (usually #2) :" r: j6 b/ [: W& n* F" T+ y

& d9 C. K, Y; P-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) g( \" b2 d- u\Uninstall\SoftICE4 i% [- j7 o3 `5 I- R
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ {9 \. K* K* Z5 Z- P! ?-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
( h% \$ o4 c1 |8 ]\App Paths\Loader32.Exe0 }1 R+ Q% z0 w, B2 s
: {# q' R8 A& \- J. @, X0 h9 k
6 d! D5 A1 ?" u2 n* `: K
Note that some nasty apps could then erase all files from SoftICE directory2 Y1 [! s  z4 @* i! ]% W% W
(I faced that once :-(! s! b, Q* i' f2 c

# t7 Q8 j# Z& V" h$ kUseful breakpoint to detect it:7 u4 D0 d; F# r( O& e+ }# A

" ~1 N" ]& l* y0 B" b: `  x     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- s2 e0 O$ O8 t6 A" @) S1 ]

8 T7 J$ D( K, v__________________________________________________________________________# @4 K* r" n) L) T' i; K

  K) W' D7 g8 P8 j+ {
1 \1 x) g2 O! d. o& P9 B* \  e% BMethod 14   ^& x+ q  ]6 I3 T
=========
) l2 Q8 y9 G& D) r8 }6 \1 B
( V* q* N3 J+ s! D+ e: l0 [  |$ eA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 v# @1 ?1 G6 C( C. ~! M5 [7 p& z
is to determines whether a debugger is running on your system (ring0 only).
2 \$ g1 E! O# P
6 ~- l9 K* c( ^" W  P   VMMCall Test_Debug_Installed
9 T7 e% i6 d( n( h: F   je      not_installed+ x9 \& {, L. n% a0 u2 i- `
" Q5 a4 v; n+ h
This service just checks a flag.
0 e0 w' d9 W: n/ {3 N( k( C</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-23 03:00

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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