About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
' z2 s0 }: R) B: S; b9 N2 q3 W  D<TBODY># Z4 c3 O) Y7 e& z$ l# C8 Y
<TR>& a1 S0 @% C& Z3 Y7 A+ U
<TD><PRE>Method 01 $ Y# ]! O. j3 Y# D  q6 ]: y3 S
=========
* S& L' K& @& f+ W5 d7 L9 D5 x! T
This method of detection of SoftICE (as well as the following one) is. T( l* n( w/ [! V+ N& }+ z
used by the majority of packers/encryptors found on Internet.: {5 S! g& B' y2 G, J6 `6 ]
It seeks the signature of BoundsChecker in SoftICE1 Z% M. c0 L8 t1 Q! Z: T
+ F# U. Z* U3 F9 R( W
    mov     ebp, 04243484Bh        ; 'BCHK'8 n' ?' }+ r$ b9 m
    mov     ax, 04h
7 [5 K9 b6 l# T* r( f    int     3      
% e: F1 E2 j' G3 p    cmp     al,4. t( k3 O9 b4 `# p
    jnz     SoftICE_Detected
. R& X5 c& V: u9 \4 Z) B% d
' _8 v$ s) Q6 c___________________________________________________________________________# N$ n& y* r- A) D5 ~
( z9 v9 G; a& ?
Method 02
! d6 c0 ^$ m* q0 L/ [) y( s=========+ V3 ~0 P& @- t: ]+ q$ w: T

. ^" ^' K/ _8 ^% a, @" `Still a method very much used (perhaps the most frequent one).  It is used) c0 g( \+ T) G# s4 H6 B
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ a( g$ a# g9 _; i  a8 V: L$ o: e7 \/ ?, _or execute SoftICE commands...8 c& ~  z# F0 z7 ?
It is also used to crash SoftICE and to force it to execute any commands
" d6 U, g+ g$ J7 y6 V6 H(HBOOT...) :-((  . P$ O( U. C6 ~9 z. m

; L" C2 G, W# LHere is a quick description:9 _# M5 Q8 m/ d  d- Z
-AX = 0910h   (Display string in SIce windows)
& a+ v! P4 W* Y+ f9 J5 o+ G-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 T9 }+ n8 ^+ [% S8 Z' s2 g8 A( M-AX = 0912h   (Get breakpoint infos)
  \# c) ~6 W5 h; n1 B$ ^8 g' i-AX = 0913h   (Set Sice breakpoints)
* @8 `6 R  i, A& |+ C$ c! P8 b4 R-AX = 0914h   (Remove SIce breakoints)
/ J% R0 U: U7 @! O) c
4 |! s' \4 `( ?6 N" w. b/ }# kEach time you'll meet this trick, you'll see:
: o, [( l$ M& ~-SI = 4647h1 R: w) ^) Q7 J+ s9 ]
-DI = 4A4Dh/ @6 J' k" V# F) |/ ?( e6 T9 v1 O
Which are the 'magic values' used by SoftIce.
0 I. g; V& d9 ]# @, VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) \) P  B3 t6 ?" J: q( m( }) ]/ E, E5 R8 ?8 {9 h0 ~4 e$ c
Here is one example from the file "Haspinst.exe" which is the dongle HASP' v2 ]: K$ }# e1 m3 F  w! O
Envelope utility use to protect DOS applications:3 A. a/ G7 R& E8 ~# E, V$ s  m0 Y
2 n3 V( e. ^) J4 B2 _$ }+ r: D. n
$ s1 Q: z' i8 X8 I" H3 O7 v
4C19:0095   MOV    AX,0911  ; execute command.5 v# y8 R7 q! C% e. P" Y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" l4 a. k% V; t: `0 ~4 c' P+ H4C19:009A   MOV    SI,4647  ; 1st magic value.
: M3 j9 c" }( E* O9 {# B4C19:009D   MOV    DI,4A4D  ; 2nd magic value.) u* r! k- q3 k# B6 C! [  J
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) H" ], f" a3 _. B$ R  G
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; @3 \4 a7 |5 v" \4C19:00A4   INC    CX
; N; X/ {; i+ X5 M" e( ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( h5 F, c  c3 w: A) [7 B, m4C19:00A8   JB     0095     ; 6 different commands.! S% T8 z/ ^- y# I( l$ [# E! a
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." u: K/ `+ k1 }. G6 c
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! b0 B. u4 O% d, u: C

7 [/ ?1 @& v0 f- l& A# m0 ^The program will execute 6 different SIce commands located at ds:dx, which
0 ~+ I- Z1 Y" V5 R, pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
2 z3 {: N5 e3 R- ?4 F2 U
' K- l* F2 d5 t# M& X% z1 M% n; a* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
8 ]' b5 |- L* A) F! C1 y1 r7 p: q___________________________________________________________________________
7 }/ _% I/ c6 y, b7 w& m. ?$ N8 k# j8 m

8 R  X* r. F' n" t( u* ?Method 03* D+ q- g! H" s' G+ O$ i) R
=========
+ F9 y( B5 E( ~7 `
; Q  R- F: g- ], E# M. E% j9 V, L. ~Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
# c) p1 D- e8 F( Y. X3 u6 P0 z(API Get entry point)
6 p  o7 `/ ~5 H+ Z0 }; I8 u        
9 V2 s. S* E9 K) q- T+ M2 ^! i+ t; d/ A: R6 ~4 E: G8 l
    xor     di,di& r3 j5 c0 l6 g
    mov     es,di: \+ ?$ q; H+ A0 M$ b% @
    mov     ax, 1684h      
& Z; Q8 W& |+ I2 C, N2 c    mov     bx, 0202h       ; VxD ID of winice9 R4 ^, M$ a9 f2 E9 `
    int     2Fh; L/ {6 ?. t" k, h* v. s; E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  I' F6 P+ @1 R% L9 x; i) K    add     ax, di
! T1 c9 t" {3 q# j1 k  B    test    ax,ax
8 G: {% g- V( t9 o9 _- S) T3 K( U    jnz     SoftICE_Detected* p5 @% P' F7 y2 ~
% `4 `( L! O4 x! A: h4 T
___________________________________________________________________________4 i3 M7 P2 H3 f: p' C
! H. z( u* X8 ^
Method 040 p& p  ~0 y+ k/ z( H2 N3 ]
=========
3 Y, Q! }% P2 X, D! K
0 k8 ]# S, o: I, C/ Y1 cMethod identical to the preceding one except that it seeks the ID of SoftICE/ l5 r0 W; c* L* T1 M
GFX VxD.
" q# z' k4 v; D7 H5 d
# M' z6 I+ Q) i% H. |; ~, r    xor     di,di( f4 B& z6 R' V4 z9 {& n( |
    mov     es,di
+ f9 s1 S  A. E    mov     ax, 1684h      
2 s! ^! B  ]8 }/ V; N  o0 G    mov     bx, 7a5Fh       ; VxD ID of SIWVID
: R5 R* s% B, z  W, l4 D    int     2fh
" H: Y3 y1 ]- e' ~    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ S, s: \; B9 q" r" s5 q
    add     ax, di
6 I+ _1 N  }" v+ K8 x  f    test    ax,ax
; I0 K2 _: Q- u' b7 W) S    jnz     SoftICE_Detected
( `2 K$ V3 M: ^4 D7 r; ~9 G& V# F; f5 |$ A
__________________________________________________________________________4 `* F& _4 p# J8 |* ]' S1 l2 Y

) C- ^* U. j, l: u% J6 J' F9 ]( S' Z7 a- ~$ R$ O( q% |) S" o
Method 05
1 v' _- h, {9 S# m=========
6 f* U3 E1 {2 h9 N! ~8 z' x* W* Y3 B5 A
Method seeking the 'magic number' 0F386h returned (in ax) by all system5 P% g9 ]. G3 Q
debugger. It calls the int 41h, function 4Fh.
: v& O8 T. d4 {) @$ u! V' gThere are several alternatives.  
# I0 H/ r% v2 O. ?( d0 {8 g, H6 A/ E9 ~
The following one is the simplest:1 z; n6 B. E2 [7 J# ]( a2 L. R, A

& R& {) i: `% l$ }    mov     ax,4fh+ p% b) c( s4 s
    int     41h  E4 q4 L6 }. u. I; s- M9 X9 Q7 T
    cmp     ax, 0F386$ q5 D# I  e8 ~( l, O$ z9 l& i
    jz      SoftICE_detected
% D; x8 _. S" U/ {
! g( {' t* W) ~0 U
7 R6 G. c2 k& s( E8 ?" QNext method as well as the following one are 2 examples from Stone's 5 C* s" ]4 w1 u8 t; C, Q% W4 U
"stn-wid.zip" (www.cracking.net):
* P" d1 q, @- \' |# i& a: @
1 A0 G6 n' X8 c/ j" z7 l# T    mov     bx, cs; n" L2 X1 U+ E) O" x4 J
    lea     dx, int41handler21 z3 }, H% p7 W  Q* g2 d
    xchg    dx, es:[41h*4]5 w+ d$ n9 d: h0 c( K4 c% N
    xchg    bx, es:[41h*4+2]
- F. T# U1 B$ I( s    mov     ax,4fh
0 @" o* ]2 U6 ^/ V! o    int     41h
. G, J, ^8 v8 P, u' ~/ Z1 }' z8 j/ Z    xchg    dx, es:[41h*4]
' z, F2 y3 i! ~. c    xchg    bx, es:[41h*4+2]
9 d: C- V$ {9 {1 U( M: i2 r    cmp     ax, 0f386h0 Z  }1 R. v1 j5 l
    jz      SoftICE_detected$ U4 L7 C% h+ e3 K( m( s6 N9 w
# Z) L" a% H2 L+ i2 v  g
int41handler2 PROC6 C- }3 g) _3 L. l! h/ m
    iret
. s6 s, D$ L5 q( \7 x' ?/ rint41handler2 ENDP
6 v+ D/ u5 y0 g- C' {) s( B* F" f* @3 W3 q: N: ~8 d

! ]5 ^; C0 d6 w. f  D6 n/ o: D_________________________________________________________________________
# b9 e2 Q1 X2 E* K( l5 m" R' Z( [  x' e4 H7 I6 C

7 |% Q) @4 i) f. y( _Method 06
0 k8 M( g1 a1 y& H=========  t0 q+ `: F) m7 c' F; X  o  M
! @- W1 H; A  y

9 c3 x8 Z9 a+ r1 X) @, X2nd method similar to the preceding one but more difficult to detect:
2 F: d7 _' d& E  l9 f+ b( |' [2 H
, K4 q& I2 p: d4 ^* E( w
; F7 y( k; C2 f) }' W, r; m1 [int41handler PROC$ _/ M( U" H; N! d7 p7 e
    mov     cl,al, @; P7 B$ {: u3 t* G
    iret
2 j0 c' ?% |/ G% _" l0 [int41handler ENDP
) s( `4 n7 O# E0 o7 R* w: Q* i3 s8 o/ b$ Q7 p- ?; G0 _

3 Q6 B3 p# V8 d$ S4 w$ v' O4 U1 K    xor     ax,ax
4 u7 O6 t  G$ H& f    mov     es,ax
8 J2 e/ `1 @+ Y3 u8 i$ Q    mov     bx, cs  A( t7 j2 E7 u$ k
    lea     dx, int41handler
0 i2 o7 l5 K' h    xchg    dx, es:[41h*4], v8 ~! d' S3 U
    xchg    bx, es:[41h*4+2]9 L# F+ |9 C6 f' S
    in      al, 40h) m1 [, k# Q9 h8 m
    xor     cx,cx) P4 G. u& C+ u. M5 c! l
    int     41h, O& {1 O% Z5 g2 I
    xchg    dx, es:[41h*4]
" n! {/ v  M& v& `8 ]; U% G    xchg    bx, es:[41h*4+2]" q2 h* O: S$ U' z" V9 t5 R" c
    cmp     cl,al
9 r. @. [, L, g# {3 |3 J3 }1 ?. ~    jnz     SoftICE_detected6 w, R3 T- f# M( R

" l: o; Y# \, _/ R: ?_________________________________________________________________________5 O; T: S* f' f3 ~0 M/ I1 u

, v6 ]( ?0 D; g# |3 w: JMethod 07
+ i0 F5 ?* g! O4 y2 o=========( s; |: x8 y, y, j$ a

) u$ ]/ i5 ?, a. [Method of detection of the WinICE handler in the int68h (V86)
- [( f0 n. s+ t/ q8 i, V0 A$ h8 P. ?5 o2 _" u% k( s
    mov     ah,43h
6 p/ [4 j9 E/ p8 K% R5 z    int     68h; a  o4 [- \& V1 w5 `. R9 k8 A
    cmp     ax,0F386h( _* R6 y, l: h( k1 ]" c
    jz      SoftICE_Detected
1 w2 W, k4 Y1 h+ j, v8 f! W5 K9 R
( K) ]) T* h# D9 q
1 N. \6 `) R# v! V=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 s' G5 x9 b% v1 h   app like this:) k8 v0 u9 ^; X/ j) _; T2 O- Q

# a; @: @% N5 t4 i1 p3 E   BPX exec_int if ax==685 B" K8 t) {4 u7 |6 V/ q
   (function called is located at byte ptr [ebp+1Dh] and client eip is( `; x: Y1 {' \  `1 d( n5 h0 Q
   located at [ebp+48h] for 32Bit apps)
) E& ]* w& Y: n" i5 m* f; w__________________________________________________________________________
1 Y; T5 T) o2 ^" A. s1 J6 U# l" w3 m! O: r, @, E: |
; ~( X& c3 O* |9 C' S3 F* t8 a
Method 08
- h9 ^, F9 l$ {8 O1 u=========
; L6 r/ `5 z) w1 |5 n% @3 p1 T
$ p3 A' n/ j. [' D. D  @) v6 SIt is not a method of detection of SoftICE but a possibility to crash the2 v1 A2 Q7 `" d: z
system by intercepting int 01h and int 03h and redirecting them to another
: s7 B4 c) ~1 [routine.
& N( n. x/ a3 i5 K% b/ L( ]' I4 X$ U4 wIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: D5 K4 w, L# G4 p8 g2 A8 w' `to the new routine to execute (hangs computer...)8 d) X$ h8 U/ n5 P5 ]/ b/ _

; G/ O! g( J+ y- y    mov     ah, 25h8 ]. b4 Q, y) c: p3 k6 ?  Z
    mov     al, Int_Number (01h or 03h)
' H- a6 Z2 D( v( `    mov     dx, offset New_Int_Routine
4 U' z5 |$ _  V, [( z    int     21h& m) _0 j3 A2 J0 r+ V4 i( V
& v) k" p+ [4 g% Q
__________________________________________________________________________$ B7 v% f, }+ H- v
1 `9 c# v5 O4 l3 @" S2 a
Method 09
0 u+ N7 w" X! s$ V1 t3 P=========
& w" J) p/ ]/ ?% k$ M8 a3 w; \0 K1 l8 f% o5 L0 G
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only. o- _  ^( e5 L- `" c
performed in ring0 (VxD or a ring3 app using the VxdCall)./ a9 f& G: {' X- g+ V/ a& U8 f
The Get_DDB service is used to determine whether or not a VxD is installed- x  i5 O; n8 u6 H) z# T) k
for the specified device and returns a Device Description Block (in ecx) for* ^$ Z0 S( H# u5 P. Q; o
that device if it is installed.8 v/ r) ^4 a% L0 C; q6 }# Q7 d0 F

5 g( ^+ u$ I2 z: G, @7 e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID  ~4 ?; y; n6 z% K
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
$ @* R" w, [9 n) q; q   VMMCall Get_DDB
2 e" u( l! k0 v$ F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
! i8 [# f5 I: n+ }$ T" h4 N- |) t8 Y) w- h9 g
Note as well that you can easily detect this method with SoftICE:1 P* x( I; y$ K: T' s$ ]4 W
   bpx Get_DDB if ax==0202 || ax==7a5fh
" I2 ~. c: o: Z+ M+ |
& J" H9 J9 b% m__________________________________________________________________________  I  k1 F" k7 a9 ]4 _0 T

; x7 a7 c6 k! v, E" @8 [% N+ s  `Method 107 h- J5 W- c' f( T
=========& E" K2 Z7 h2 f$ b
: S7 E/ s! O+ w5 V# `  P4 }
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& a7 y% N% w4 G, f$ N  SoftICE while the option is enable!!+ C$ B4 d0 f5 y9 ?! U* o% U* o' D

( d; K! m) P' {: aThis trick is very efficient:; i  M: a; ^' H6 {0 o4 v
by checking the Debug Registers, you can detect if SoftICE is loaded
5 u8 Y& ?$ H/ o5 g: \(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 e9 [7 g% P3 O0 G) k6 L5 ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their
2 d# L# E  G$ Q5 ~8 @6 C% W% }value (in ring0 only). Values can be manipulated and or changed as well
$ g8 l4 \* q* m1 U(clearing BPMs for instance)
% w- k: O8 B" I9 K$ m" H+ q( M
6 I; J8 X; k- l0 T__________________________________________________________________________
9 \4 f$ g5 F0 r
( j6 x0 k7 M) W2 P4 lMethod 11
0 v5 F  ~; d$ t7 g' f* Q0 Y=========" w/ H/ ~! m! f' E; q

8 |+ L/ |7 z* iThis method is most known as 'MeltICE' because it has been freely distributed' g$ c9 |9 O4 e, B
via www.winfiles.com. However it was first used by NuMega people to allow
7 H9 [0 ?: N" z& ZSymbol Loader to check if SoftICE was active or not (the code is located4 c, s  L2 F2 I
inside nmtrans.dll).7 @- q; P; X5 k: @6 x% _: E

# _9 B* t& Q/ X8 mThe way it works is very simple:
! ]0 a5 L8 }" c4 O6 U* OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
! v& u8 p5 ^& ?! ?- @6 @WinNT) with the CreateFileA API.
2 H' E. T" S% `& N* U% R2 ^6 [) D- D1 W" [
Here is a sample (checking for 'SICE'):/ ]/ J4 X7 w; ]5 |$ Y

1 c( x" F4 k! ?BOOL IsSoftIce95Loaded()
9 B2 K' Y" n7 W! U+ c{
/ F7 H- k) a" H   HANDLE hFile;  5 S0 w+ D$ R- S  Q0 g
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 Z& Y5 \8 z: j9 f
                      FILE_SHARE_READ | FILE_SHARE_WRITE,# l* C$ ^; K# K
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
9 \6 L& S5 T. H( K   if( hFile != INVALID_HANDLE_VALUE )
9 C) U3 y6 F& j' {   {
4 Q" z, `  K* ^6 s8 Z7 O( G& }      CloseHandle(hFile);$ U& L8 ^7 x% i; y* m
      return TRUE;5 H; H- W( G, N9 Z
   }
4 G/ u3 a% A* `* @   return FALSE;
$ _! e; n) c! \9 i/ N5 J& S1 L}0 x. E; B; A8 K# P

, y- c3 Y6 n6 `$ d) ~Although this trick calls the CreateFileA function, don't even expect to be
  x) P: ?' B7 o8 F' w0 f) `able to intercept it by installing a IFS hook: it will not work, no way!( m* J" t( v  o3 L. p( S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) W# M) I/ P6 ^# q& m; Aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 Z% M1 E3 j9 @. ]
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 X7 B# P; K6 K( A: _field.
& x3 f; K8 I8 R7 eIn fact, its purpose is not to load/unload VxDs but only to send a
- F! V, q( }' R: q, B: O2 \3 N# zW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 n  K7 g1 g/ h' o; b. q  J* W- ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try$ R1 [$ p$ c; G' I, v* C
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 {0 F% U* k1 X6 O+ f$ AIf the VxD is loaded, it will always clear eax and the Carry flag to allow* n+ s7 D) w6 N$ ]0 B% o% h$ i
its handle to be opened and then, will be detected.5 R+ x* H6 l$ N) a) g& p
You can check that simply by hooking Winice.exe control proc entry point0 d# U+ j) ?- u
while running MeltICE.
8 L( \, B( h# E+ t7 e/ ~3 e
" V; o9 V1 n4 ]7 f3 {: f" `8 v- M
  00401067:  push      00402025    ; \\.\SICE
/ Q+ W) ]' D, U& t  0040106C:  call      CreateFileA
- F  N' P* s. b8 g  00401071:  cmp       eax,-0018 \2 e8 ?/ p6 X/ l' S% o
  00401074:  je        004010912 m- @' `: W4 n3 y/ m' D
) x6 z; o# @3 ?7 @

% y4 P2 P) M% W0 ]( OThere could be hundreds of BPX you could use to detect this trick.% P- h6 o/ ]6 q$ }& B
-The most classical one is:6 X, O3 ?, Y- l9 a- p
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 Z$ k0 }+ I: ~7 A1 T
    *(esp-&gt;4+4)=='NTIC'# X! V9 {6 m$ N
2 c! [% B2 R' t5 `$ a: n' D' y
-The most exotic ones (could be very slooooow :-(
$ b. G4 k# u( |, U! }9 g   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! x8 n1 h& }2 l     ;will break 3 times :-(
: E  O& L2 k2 k/ P7 u- L6 ]- W6 M1 Z8 d
-or (a bit) faster:
9 K- F( U3 S- a# _3 r, R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), q9 M+ ?7 _# \: A
, K! i2 n: u/ g" L- D  V. v
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: `8 j8 |+ Y- J% \; _7 i: F5 c& Z' V     ;will break 3 times :-(
- J9 K2 _" a0 ], v# x
6 ^0 H1 d, P: c& N8 r8 K! m8 t-Much faster:4 V& {2 U! t- R# K/ e. l5 M
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') ~% z$ A. C+ I% D
5 Q$ Y& K' p" ^" u
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen' c/ [$ r& K; t) z4 |1 c6 s& r
function to do the same job:' M) r4 {* M0 J; F) u2 h: \' }

/ O0 O; n' n' I   push    00                        ; OF_READ* Q" T! R0 A# f& X6 _6 ?
   mov     eax,[00656634]            ; '\\.\SICE',0: J& ?7 P% o$ ?" ]/ _" ], L" ]- m
   push    eax
9 ~0 H' r# [% ^) _5 M) z   call    KERNEL32!_lopen/ g$ s/ Q+ p" G! B, Y2 m
   inc     eax9 g) q2 h# W9 r) m. K; U, ~' s
   jnz     00650589                  ; detected
' }, t# o. |. t0 A   push    00                        ; OF_READ
( X+ r- h4 G! O$ S( f: X' z   mov     eax,[00656638]            ; '\\.\SICE'
) T( F! a+ O6 F% T   push    eax
/ v" W; b0 @: p' z" S   call    KERNEL32!_lopen/ c2 ^+ a4 V; l/ y6 ]: o
   inc     eax
  P4 J6 s  B' D/ t9 Z   jz      006505ae                  ; not detected; }: h7 o9 U$ X0 x, }
. d) l$ F( f+ h0 M
, M( R+ N/ @* ?& U
__________________________________________________________________________
3 G6 p. V1 I5 w, ]  L  G: a' l- L7 K
Method 12
/ |8 T& b/ x( X# N0 X. I, W1 H4 \6 s8 P=========5 a- X$ v9 X1 _
; m& n- f3 t% t
This trick is similar to int41h/4fh Debugger installation check (code 05
" I, }/ |% w& f&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 s* T- s1 ^% Y* V
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 w, {: Z# q& c9 @; |( s
! L/ o4 k7 T, f   push  0000004fh         ; function 4fh& a2 P; D! B( r' p1 o3 E- J8 o
   push  002a002ah         ; high word specifies which VxD (VWIN32)
* V  s: }7 i: J. }                           ; low word specifies which service$ c/ \8 O; A+ F0 C9 X
                             (VWIN32_Int41Dispatch)3 V- C8 l1 z. J  N1 m7 q
   call  Kernel32!ORD_001  ; VxdCall
) h! E7 o4 O' \3 t   cmp   ax, 0f386h        ; magic number returned by system debuggers3 V9 G9 g3 E1 H! n0 u
   jz    SoftICE_detected& Z' f" l( h% |9 K+ \

7 o" H2 s4 T% n5 J% W$ U& VHere again, several ways to detect it:0 U1 J; Z$ O: K5 O% g6 \
* m) P+ f7 y; `5 N2 g" q! h  E
    BPINT 41 if ax==4f& A1 P! i7 Y5 s# z+ q1 F. ]( a
% D; d$ t7 s" v% l5 n8 \
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
; h; y, i/ q4 |# ~: O
- J1 c- x: h& F, d    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) {0 P$ P/ Y+ S* P2 F
0 U3 i# _6 Z5 k* w" I
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!' ]* e4 Q7 V, w& Q  F! S

9 D4 C9 B! Z) i, A0 u/ c5 k__________________________________________________________________________
) s1 b: f5 j; `$ @1 O: T3 N. |
. |) [1 _4 G7 c- h3 RMethod 13- L+ N, S; t  b( k/ Q
=========( T/ y/ e- r) ~# u) X

( v- U0 t+ g* s1 t: SNot a real method of detection, but a good way to know if SoftICE is+ R" U" v# N1 F1 K! b
installed on a computer and to locate its installation directory." o* I, F# Q3 s
It is used by few softs which access the following registry keys (usually #2) :' l, \1 w" t' V, i& H

  W; R2 d, O6 j: s7 M3 p" m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ @$ ^% |0 n6 F* Z9 M) w7 N# ?' [; y\Uninstall\SoftICE
! f' S6 Z) a5 L) j9 ~-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ m8 B% I: Z# h" L' z-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) R0 e; E* O* Y( V  G3 y" A0 L\App Paths\Loader32.Exe- ^7 s# c: U* f8 K& A0 r% Z
6 n  P8 ?7 S9 E$ n* o0 c" m

: v2 \3 d' c! @: }: e0 J+ HNote that some nasty apps could then erase all files from SoftICE directory/ Y( U$ x3 y5 q
(I faced that once :-(; W, c* }. H% W/ e4 w: d+ T9 s% T
/ R. I& h8 X, a9 P
Useful breakpoint to detect it:
0 L4 C  D$ L1 X. Y( s. x( ~0 U% o
) @, @2 h0 o3 N, v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. \( ^1 r# f8 N' J; ?' l: E6 L, Y1 j
5 l5 O) T9 m8 N5 W# D
__________________________________________________________________________, M8 @  n, @7 @
( s! s; V* }$ K# O" n
% |. }8 n# q" x: X9 [
Method 14 $ Q. L. c0 s7 w/ Z
=========
; S2 z& W# w/ C( J) d9 ]- ?. [
3 {9 H. O( O; bA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ r/ ^+ V3 f+ g
is to determines whether a debugger is running on your system (ring0 only).: n; Z$ [4 c5 R) W. R1 S$ ~1 P& e

* u  p3 O4 S; `* C. S: S9 a6 U   VMMCall Test_Debug_Installed5 p, x" X* W. Y$ m; E  O
   je      not_installed) S8 l8 Z8 I9 J. U& O

+ v$ h3 H/ ]1 s; h/ O; cThis service just checks a flag.0 o" b4 n2 i, x2 v% C2 w
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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