About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 e" n/ O- i& M  z1 Q8 Q<TBODY>
4 f; l$ A( q; N, n; j<TR>
5 G( i% H. D- f0 s, \- L<TD><PRE>Method 01
7 Z9 S# z% ]& o* H$ v5 o. Q$ y=========
% q9 w) V( D/ H7 l- p  d' l; \5 H% x
This method of detection of SoftICE (as well as the following one) is9 q; B  ^6 P) x$ W7 `
used by the majority of packers/encryptors found on Internet.
4 O; m; s- C' F% X; M" _# HIt seeks the signature of BoundsChecker in SoftICE
- O8 i/ x6 h6 r  r: @2 D$ I$ q
6 [# @4 ^3 `) R    mov     ebp, 04243484Bh        ; 'BCHK'
9 q9 d: z" Q( ?+ L9 I8 ~    mov     ax, 04h
7 O) U3 L8 W' _5 n6 K, w2 w    int     3      
: E/ f' Z: C6 L8 H+ y; M    cmp     al,4
, t6 C! @% V6 d    jnz     SoftICE_Detected1 _  f8 z& J8 B0 H: j; r- r: n4 e
: |6 p! f3 w9 u% R3 G+ g
___________________________________________________________________________
6 r+ |/ ~! _$ E; c6 W0 n$ u* \* [1 l* E* w0 ~2 b7 s
Method 024 v' C. i2 K7 ~
=========  |5 g6 ^, L8 _
5 s( s+ u- D. V& u9 h
Still a method very much used (perhaps the most frequent one).  It is used3 {5 r# z0 }6 {2 q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,9 H3 }5 h4 A* n0 U. F
or execute SoftICE commands...* G. [* W/ O( R- G% q6 k5 ~
It is also used to crash SoftICE and to force it to execute any commands
  K7 R" o) |0 \7 z(HBOOT...) :-((  ; g- O9 K2 R6 s& W: t

1 R' h  k& m+ J6 F9 `- Y6 ]/ W6 t6 oHere is a quick description:
5 e/ q( m1 v) _! a) g. g( a3 j4 l-AX = 0910h   (Display string in SIce windows)4 Y/ f3 N' G* x6 d0 C, K
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)& \6 W* p# J- z7 w' ?! x3 [* L$ c
-AX = 0912h   (Get breakpoint infos)2 \/ h* ?6 o+ ~0 a9 G) b
-AX = 0913h   (Set Sice breakpoints)
; M8 z$ E6 R1 \-AX = 0914h   (Remove SIce breakoints)
9 k; u2 _% {2 A' B" {% Q$ O4 a$ p# ~1 @! i" c3 e
Each time you'll meet this trick, you'll see:: V5 B$ _- N; ?4 s2 ^  a4 f5 e5 R. Q8 q
-SI = 4647h& v" a: b+ z- B
-DI = 4A4Dh
$ B/ `" `7 T/ `' V0 PWhich are the 'magic values' used by SoftIce.2 x' a7 s$ J% }$ }, C* }# g- X6 M
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.: m* ~) S$ Q9 _
7 @3 n! I4 w$ Z+ N' G: J) C
Here is one example from the file "Haspinst.exe" which is the dongle HASP) ^! [% d' a. ~5 f4 p3 j  E& S
Envelope utility use to protect DOS applications:: _# y! |$ r( s( g

9 K( q8 H, r6 S0 E/ m% S& f. m+ {0 Z/ }2 q% g
4C19:0095   MOV    AX,0911  ; execute command.  Y) ?- t, ~' U+ x
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ G. `6 Y1 m  h/ J$ \1 Z+ m
4C19:009A   MOV    SI,4647  ; 1st magic value.  q' s* }( _% E- W7 {
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
" B( Y5 L) O$ [! ~4 d( I: X& Q# ]+ j' \4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  y( ?7 S. t( F5 S( @: G+ k* Z4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ ?* v) W1 v6 ~1 q9 T# F! }' O
4C19:00A4   INC    CX3 f8 J  `+ E- O7 b7 L1 H# f# ^0 \
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' T* b' W' L% H# |" k, Y
4C19:00A8   JB     0095     ; 6 different commands.3 ^5 J0 p' c3 E/ [
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. i  \3 `7 l! D! ~6 M6 ~% ~* G: d. _" Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 Y# y: v6 v9 b8 c5 J
- `4 R1 i! |# A/ _/ bThe program will execute 6 different SIce commands located at ds:dx, which
, n9 q: {1 s' O$ Y" kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.) ?; i1 Z, q: Z9 @5 B/ L
( z, r* @( J% j
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 d& R8 Y% {, V5 q: H___________________________________________________________________________
& Z3 `# V7 A4 S/ [, E3 E# K* t- }
* J8 ?! r! e8 y9 }
2 @4 F- i+ r, Q* A+ oMethod 038 i- A2 M. }. o1 W3 O7 o1 P& K
=========
5 `" ]; ]$ ^% J$ R$ }
  d* U7 Q+ x. j$ oLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% Z( C1 B' G/ q; L
(API Get entry point)
* Y) c9 O: Q, c+ A3 }1 d        $ {; Z) e' A. U6 |- D/ o

4 D& b; M( `' j5 f4 H    xor     di,di
1 j& b( `5 |$ d$ G    mov     es,di  z' y1 j3 P& g  d8 U; @
    mov     ax, 1684h       2 }' ~9 f) \( q+ m; g4 Z" o
    mov     bx, 0202h       ; VxD ID of winice3 N) T# O: s7 Q: X& V) z0 E
    int     2Fh
$ |# Y" z% c' i% g' y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  G' @  Z, E* B& r5 `9 `0 [    add     ax, di7 E6 m* i0 x. g' w* S! G
    test    ax,ax2 h3 _( T) L# L' Q1 q7 G! _8 l+ Q$ G
    jnz     SoftICE_Detected
; j; t7 X# c) {0 D7 ^; d% |
& F1 z1 @' v9 r/ d___________________________________________________________________________2 R0 _& E, e+ {/ ]4 y

7 B' v! H9 c0 k  i. w, AMethod 04
( \: v$ B+ r9 k: ^% g6 @" [=========
+ Z3 G9 L& `7 G& @1 s! X3 g. J
4 C& `( s9 j+ [Method identical to the preceding one except that it seeks the ID of SoftICE
# N8 L2 K& _$ f& f: @GFX VxD.
! K/ S/ ?1 `" t! ^( q9 Q. S8 a8 O4 p% c9 M  O2 Q  m1 F+ i3 F3 V
    xor     di,di
5 n% [/ t& P/ X9 ^" d+ L    mov     es,di2 x- }( l3 V+ S: q% t8 G$ v  R8 z
    mov     ax, 1684h       4 {0 q8 l- z" w
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! |' P* }  [9 Z2 ]: \, g$ F: |2 v( Z    int     2fh
0 P6 Y% L$ ~3 S. {* q% G# n! c    mov     ax, es          ; ES:DI -&gt; VxD API entry point
# D2 w" n+ s+ W, i    add     ax, di* }' a3 z  y4 v% X. [# S
    test    ax,ax
2 d$ x9 m! \6 L, N0 ~' f    jnz     SoftICE_Detected8 D! c- ~% s& |! h0 @+ J/ J. u- W$ v

( k; x# e3 W" I' _% U$ M__________________________________________________________________________. o$ h7 T' U' E  q+ Z- f

% `$ j, e3 t9 P! S4 f- `+ g( s4 Y  M9 N9 y( G" {! L: D) L
Method 05# O8 W$ }) h8 F- w1 i+ F4 s
=========
; _2 p% k! t: k0 Z8 b$ G) K5 o9 L
, y9 x& x$ _7 CMethod seeking the 'magic number' 0F386h returned (in ax) by all system9 w" x, ?' `9 h# W) v( y
debugger. It calls the int 41h, function 4Fh.
2 g( f4 z: D3 iThere are several alternatives.  
8 R  t2 G  H6 E# F) [5 w0 B. Y$ t0 W: H
The following one is the simplest:
' z( L9 k9 w* ~7 I, J; f
+ z2 G) F6 M1 w) m5 I    mov     ax,4fh% x$ L. H& [, m/ N+ {- C
    int     41h
% Z/ a7 e3 t5 E    cmp     ax, 0F386
5 b& R# A/ ~0 K# g- v! t( a    jz      SoftICE_detected
0 W* C6 x# Z. d: O- O, }  w6 Z! `9 f/ P2 H' Y
1 E! i+ j8 u# t8 B! H
Next method as well as the following one are 2 examples from Stone's 9 ~0 j  D0 A7 Z5 \
"stn-wid.zip" (www.cracking.net):) C2 y( ^- G& A/ W' ]- ?

, y- d: _' I  {5 _6 I7 n    mov     bx, cs
: g+ X' O' T8 W* R; ~    lea     dx, int41handler2
* Q9 V1 v0 a2 U0 I- k7 l    xchg    dx, es:[41h*4]
# C! `" m3 f3 V    xchg    bx, es:[41h*4+2]! `3 N- @1 n: d# d- Z0 Y
    mov     ax,4fh  |' m  _, @# H0 l( |( g/ G2 W
    int     41h6 K' C5 k) i  K
    xchg    dx, es:[41h*4]+ Y+ O# l* U) |3 H8 Z
    xchg    bx, es:[41h*4+2]5 j. ~, ^# H+ o& K4 |- A
    cmp     ax, 0f386h- S7 s. x' o9 G" L
    jz      SoftICE_detected+ W) |; K& q# D: o0 u- N$ X
9 F! H- Y1 S9 s) l! w
int41handler2 PROC  L0 s! x6 X  Q7 e  N1 ]  u; ^, \9 b
    iret, a3 ]. z+ y3 W; g- b8 I- y, P* A
int41handler2 ENDP
$ n6 g1 E" D( L% z, R4 i) d& X/ r5 I. I& r' d8 L  i& z

/ D* c: u: n8 y6 d, L. |( T_________________________________________________________________________  M( A4 C: z2 a8 U7 n  \/ C6 F. ?

: l/ g" M( n% {( R1 r; f. `7 P. v$ o0 e
Method 064 ]! P; O- j$ G- q
=========
) _& k+ V8 i* e0 b6 C' [* F, E7 w! T; a1 @; p) v
2 T$ `0 Q* c, i" }& B
2nd method similar to the preceding one but more difficult to detect:
/ G! r% Y1 [% ^2 k) g
& }4 T0 @. V: G5 I
2 m- ^, u) o% M, e# S/ Hint41handler PROC1 x# x4 [) ^( D: T1 Z4 K
    mov     cl,al
& o  M% @8 p+ V; W    iret
6 P$ O/ p* c8 Q0 d: P3 M7 rint41handler ENDP. x9 K2 I' {- Z! ^. e: N
& ~/ h" r& p* `) B( p% ^
( p  H$ {/ f6 y" t
    xor     ax,ax
( {# P/ y2 i; O' f1 m, d    mov     es,ax# n$ F# {0 F' k6 }
    mov     bx, cs5 X/ a, {& I: g8 H; G  F/ M: a
    lea     dx, int41handler/ f/ ~0 p* u' R" O. {
    xchg    dx, es:[41h*4]
, j7 Z1 b% R$ z7 t/ O; D$ N- m( t4 f    xchg    bx, es:[41h*4+2]
, ~5 e' I2 P: @4 L* W    in      al, 40h
" M0 A9 ^- a/ ?( V  e5 \: |# I    xor     cx,cx
+ m+ S$ @' v3 M- G3 T$ G    int     41h
& M7 l0 o* r' p- d    xchg    dx, es:[41h*4]5 ^+ H" d* Q, y" ~1 |# J
    xchg    bx, es:[41h*4+2]
  s" b* \* p  X) s4 p9 W" R    cmp     cl,al  E) J$ E5 |4 V; Y1 [5 ]/ C( Q, d
    jnz     SoftICE_detected- ^6 E% z7 d. ]4 [7 W# E. j

/ d, Z+ ~( w* w2 Q0 M1 b" f! ]_________________________________________________________________________
: P0 b2 F% d3 `+ {/ H: S
! l8 @+ |* V' n8 yMethod 07
+ m8 A% k6 R& o) D=========! N, t5 R8 b* ?0 F- C0 @1 L

. \$ {! i% r3 q; hMethod of detection of the WinICE handler in the int68h (V86), U5 e0 y9 n3 i/ N5 }& Y# a
# i2 A& H# u, D" t0 \% N! {
    mov     ah,43h
$ I9 P* L9 I9 o# B. D    int     68h- T5 Q6 n( O+ \$ e' P/ d, i
    cmp     ax,0F386h
$ R8 u8 x2 |7 D, \+ M- Y% n    jz      SoftICE_Detected2 ~4 [' p# j6 n3 k! Z/ U( V

2 `9 T: R# ]8 g- O6 H) Q$ y. B( d
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 o' A4 S) }6 G9 J
   app like this:1 A% Y. [1 V1 A1 \: _$ b# [1 Z: n5 \

5 {8 q% q& p- b" x( [   BPX exec_int if ax==680 G5 o  \& M+ _& ]' Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is  K; c) |; B) H4 b
   located at [ebp+48h] for 32Bit apps)
1 Q" M; A  N& _9 X__________________________________________________________________________
; G! `; J3 `6 @; a4 @. z4 X7 L6 Q% Y
7 ]- Q1 A/ Y. `; l0 C  C1 u. u& }+ T; f* q: R9 s- k; b1 W
Method 08' S% L( @; j. q; k, G1 x
=========
. h' E: m4 y/ H, I, |1 Z
" [; q4 U8 ]% |  GIt is not a method of detection of SoftICE but a possibility to crash the8 v4 e5 E2 D  ~* b. V
system by intercepting int 01h and int 03h and redirecting them to another
8 I: a2 w$ f  rroutine.) f% d6 n, s! a8 }
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) A9 b( h$ Q4 P( x0 @
to the new routine to execute (hangs computer...)  o% I! m1 B2 Q" l0 p- i
6 m% m) `: L: |- Q
    mov     ah, 25h
5 l: H  P  _' a  H1 A    mov     al, Int_Number (01h or 03h)' V4 S1 G* d! l; }' z0 A
    mov     dx, offset New_Int_Routine/ J2 y5 d& ]* J- i! {) N1 x
    int     21h+ h8 B" C% ^: j( @! |( @1 r' \

8 ?' {4 [. n3 t7 y0 ]__________________________________________________________________________
7 ]& t6 g2 Q) l1 P2 s9 F; t
  p9 ^6 V' n* }  CMethod 09# L) c7 M7 N+ a! l$ }
=========
0 f! C1 d  L, c5 a7 b% b* _7 l1 M4 J( c7 _# _. s# z/ A+ x
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
" ~' `8 }2 P' ~performed in ring0 (VxD or a ring3 app using the VxdCall).
6 ^) u" q7 f8 B$ c. iThe Get_DDB service is used to determine whether or not a VxD is installed
4 F% p# }: t1 \, J" ifor the specified device and returns a Device Description Block (in ecx) for6 `4 D5 `2 X* _: O' P/ X" ]
that device if it is installed.
9 D$ x9 H+ G3 {% @" ]# U1 e1 v9 k3 M
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( W/ G$ I) A( E( ]6 G6 [1 O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! c& [# F0 I3 Q3 |0 u+ g6 Q   VMMCall Get_DDB
% h# `0 }$ F4 v& B% l# [1 |) `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 {4 ~" S9 J! b$ @
. f0 s" y" t, g1 P3 Y# h; k) q' R% d
Note as well that you can easily detect this method with SoftICE:
# r1 Y  P, B. s% n0 @: n   bpx Get_DDB if ax==0202 || ax==7a5fh$ K* `5 p1 A9 @3 L4 b0 h$ M& ~8 r

; q( V( Y6 B/ B: g8 j) n__________________________________________________________________________
7 ^0 t4 x8 N, l" m, g# E/ V/ j3 u. q* z% R$ u/ {
Method 10( p( R* W) q1 D1 O8 ^: U' u
=========
4 H. ]# x0 s! F. L2 W. G4 M6 p) u. e2 l2 M* `% m' p
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" d: r3 s4 a* x' Q2 C( N
  SoftICE while the option is enable!!+ J1 D0 c; A! D6 D

- R% b' X6 A9 D- f+ B3 VThis trick is very efficient:
- [4 h1 g) p) V* Z" Kby checking the Debug Registers, you can detect if SoftICE is loaded
5 Y5 [. V6 r5 d0 N% I5 @6 v( o# t(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' ]6 _. f4 |9 n3 ^- _there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ i! ?, S3 v( R( z! G7 Pvalue (in ring0 only). Values can be manipulated and or changed as well
! ~/ R2 t+ u9 c- v(clearing BPMs for instance)  T, c% G8 f  F( ~" M' T

$ `$ H' Q5 F4 F__________________________________________________________________________* O( a$ M$ y) H! z( a- r: t7 E

# n7 E+ {( T' h7 L) H7 u& UMethod 112 _5 y- n1 h& w- ^! D
=========
0 `7 u8 ]  c& y9 D; j# k- m0 B
! w0 N" C7 ]+ J8 d$ F* eThis method is most known as 'MeltICE' because it has been freely distributed* c+ M8 L, b- \+ y
via www.winfiles.com. However it was first used by NuMega people to allow& x: q1 k! u9 e$ A# s, D3 c
Symbol Loader to check if SoftICE was active or not (the code is located& d* V5 e7 Z6 i( Y; N# ~
inside nmtrans.dll).6 N1 [% i# G% D! m; J

: B9 X, o6 |2 s3 B% O1 S1 \The way it works is very simple:; R- X2 t3 X& \- O# B
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) |0 z/ [+ S. [- `WinNT) with the CreateFileA API.- R: k8 ?% y% r
/ }/ u. i* {4 a& M/ |! p/ `" ^' D; F
Here is a sample (checking for 'SICE'):% W# y8 T3 E1 `0 }" o' r! d

3 f) L3 b8 s5 e  y# d+ dBOOL IsSoftIce95Loaded()
$ W5 \* q5 {# d. f" u2 E{2 K. D& Q* c5 l0 t8 f
   HANDLE hFile;  4 z+ ]/ K* p6 x: D
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,0 r5 y. {. D' m  q* c/ U8 Z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
. E6 \( E% P! w7 a# r+ |                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* I, h! N' y; z9 X0 _( I; G0 T/ I3 L
   if( hFile != INVALID_HANDLE_VALUE )7 ^* n" D6 @( ~$ U
   {" V& o4 Y, t) J) h5 h% u
      CloseHandle(hFile);. v# l; H/ T8 T
      return TRUE;
5 S& D$ f" d7 p: k, f7 n! m1 w   }' T0 y% ~1 ~# N" I( \
   return FALSE;
6 J5 `4 y$ H0 T2 R  c, |4 u$ d}
6 Q- I$ I  q! M$ _* W
+ k4 E" s( R* r- }6 s5 GAlthough this trick calls the CreateFileA function, don't even expect to be
1 u, f- T( m4 r0 B$ ?- bable to intercept it by installing a IFS hook: it will not work, no way!
6 d2 g$ K* s" RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F8 Z1 u3 j6 I) D9 o: o) J; _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ P6 U$ |5 J6 I" @and then browse the DDB list until it find the VxD and its DDB_Control_Proc
# X. I9 y2 g* _) p+ H* dfield.
5 e& R8 s: @- S5 c) \In fact, its purpose is not to load/unload VxDs but only to send a , J" P* o' e1 r% b" ]2 Y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): A) e5 I$ m$ ^' |. p- U& e( ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' x/ L: u/ @1 A! y; j
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 e  ]/ {8 r% r( uIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& j# q/ M& f/ _( Z4 G1 ~# {1 Sits handle to be opened and then, will be detected.. K  n. {/ T5 D, t! R* [
You can check that simply by hooking Winice.exe control proc entry point  N8 J: V/ j/ u6 c) A( Z- K, j
while running MeltICE.
3 m* Z  P1 B* N/ w! x! k! m& z- z8 b0 T. k& J8 m. h/ y9 d( a

% h7 I3 S2 V1 d' l8 V  00401067:  push      00402025    ; \\.\SICE
$ W! z0 _' r" p. ~  0040106C:  call      CreateFileA: N; C, ^! {+ W
  00401071:  cmp       eax,-001/ l8 N* P2 L  Q/ M3 p, K6 s
  00401074:  je        004010919 @8 g; @7 R0 a0 r
2 v' J, T1 X$ e, o1 w

* Z" _+ ^" z. |) h3 `There could be hundreds of BPX you could use to detect this trick.6 {2 P( x* f% ~# T$ b) G: a
-The most classical one is:
5 L* v" J! Z" e- q% p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 ?! l+ K. `( p    *(esp-&gt;4+4)=='NTIC'
4 @" X$ Y3 J. V( {3 }" L4 [
# n. e9 n( t6 h* G. h9 C-The most exotic ones (could be very slooooow :-(/ n( t6 `. H9 b1 O' ^5 u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 F) k+ d3 `3 }  w0 C6 k* Z     ;will break 3 times :-(
) x/ B5 M# ]) Z4 t. C5 p  k9 q/ O& }" I' g
-or (a bit) faster:
! W. i" W: G( Z$ e5 ~" f4 R   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')6 `) E2 G6 K! Y1 }

4 }. T! O$ G7 E8 s3 q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - a8 W9 X9 E7 b, m  S
     ;will break 3 times :-(
; e1 k; H- G0 L# [7 I. m6 R  s* I5 s& {! ]* [- Y
-Much faster:
; f; |, I( @( A/ J' p   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 E# {. K. J$ f8 g
; J; @$ G% N; B
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
3 G, Y/ w; a- v0 Zfunction to do the same job:5 L1 B& B5 [2 T1 F
1 `. N3 n- }. ]8 ?3 f& q
   push    00                        ; OF_READ% T: Y! n8 ]4 o6 \! j, }
   mov     eax,[00656634]            ; '\\.\SICE',0; u$ l* y; S6 u3 t* g; m. M* }0 A
   push    eax
4 z. j9 E/ {$ Q- R# o4 a   call    KERNEL32!_lopen
# S0 E: D. k) n2 ~$ I% M. ?  i   inc     eax8 k* X. ~1 X( K* V
   jnz     00650589                  ; detected
7 w/ V+ R) ~- q   push    00                        ; OF_READ
7 Z3 W7 ^! V' Y: |   mov     eax,[00656638]            ; '\\.\SICE'
$ `. H" c' H* f" I) i   push    eax3 o9 P, j* p/ m8 ~, w
   call    KERNEL32!_lopen
5 M! {( @4 S9 f/ u; d   inc     eax9 {/ z$ H# [2 \5 x8 ?0 ?
   jz      006505ae                  ; not detected
) `; @! ?& T' Z3 B  H8 p5 T6 b6 [* D/ o4 j2 ]6 z- \2 v* ?

% u; V4 X, x: ~" ^! m9 u2 c6 r__________________________________________________________________________  q7 P% J$ R5 G( c

; Y' i# h8 y5 s  R3 d3 U( s3 QMethod 124 e: m* z3 ]4 p! a
=========
2 B% u" [0 q  u
- ~# @( S$ t% W! g! vThis trick is similar to int41h/4fh Debugger installation check (code 051 a, P. u) Q$ g
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 K# Q/ W0 l, t) _% S, p  ~
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.% w- I% D. ^: S' _+ H

: K7 p, f+ Q  D: m4 Y   push  0000004fh         ; function 4fh
6 a% U: c/ t: a) a   push  002a002ah         ; high word specifies which VxD (VWIN32)9 C' y6 i: Z# ]: @. |
                           ; low word specifies which service
- A' z& ]: |- K* B                             (VWIN32_Int41Dispatch)% C+ p6 J& H% m3 f9 o; ?0 \
   call  Kernel32!ORD_001  ; VxdCall
: J6 |+ \% q$ W3 X: m% ~5 {   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 Z: @- [+ P$ J, {* e   jz    SoftICE_detected
0 _7 ~8 E) Q4 ^& u/ X) i- \6 U+ D; R/ N: x. j3 Z7 Z- Q
Here again, several ways to detect it:" ~4 V& ~# ^* a. X8 A. `4 a
. t8 P% t' m* }
    BPINT 41 if ax==4f7 E, g9 q% j- f0 e5 H
& o8 x, F( z% s# Y8 M0 |
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 d  [9 W/ S: R4 }: b$ f7 L
$ C+ i* C+ z0 B$ a. g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 C+ l1 ~" F5 c

( x8 l) Q( F2 ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!5 O/ k+ j. I6 T; M& Z
; I: U& R% @( Q( N, a$ ?; ~7 Z
__________________________________________________________________________8 F, o7 [- |) P, S6 o7 u

6 @# J- i4 A2 R- O" N; aMethod 13' K  s- |, `+ c$ ^; O: ^: _7 q
=========
7 e* D" z+ ^1 A) u% P+ ~' t/ e& ^6 V! W6 `
Not a real method of detection, but a good way to know if SoftICE is
, M% _2 v2 u7 a0 d  |, ~installed on a computer and to locate its installation directory.
# v/ U, `/ d" M/ Z4 c; QIt is used by few softs which access the following registry keys (usually #2) :
0 U* {0 m7 h) N4 }
6 [! \, m  e1 T$ @9 E: A-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% P  W5 v- b7 V; M1 H, G: x\Uninstall\SoftICE
$ }: p; H9 {7 r; T0 R-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- ?/ w& t" @2 Y" u: R4 N; `- k. c
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& {7 P: Q% I# r3 ]# Q/ H8 ]$ l* j
\App Paths\Loader32.Exe
$ Z" h, Z" _$ `4 G7 ^* u
8 |! i0 ^( C3 R; b
, o, O" M* P: b3 z( cNote that some nasty apps could then erase all files from SoftICE directory' w" @6 K7 s' f9 E8 N8 y. F
(I faced that once :-(
; W5 B0 {5 U8 i, E. j. u+ p" Y3 l5 }9 ~9 n. @
Useful breakpoint to detect it:* R. \8 o8 D6 s5 V9 ?& ?8 w

# p# N: g3 o6 Y( |  W; k     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
- t# j5 m, c( P0 Z8 a9 K$ U4 N6 f( O; ~/ R
__________________________________________________________________________
/ U0 w9 ?6 k: R$ R; o
% A6 N8 Y1 E4 w3 G0 |4 `
9 |- p* i9 N! n: yMethod 14
8 o, O, w/ I) \% ?: t0 t=========
  r/ ?1 ^% e0 t5 c& U0 R3 G6 f6 Q
1 I5 a. t2 R4 b8 L! d! WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ H7 d* k8 k* O# h1 U& R! {* V4 vis to determines whether a debugger is running on your system (ring0 only).
8 ?. g0 m  p6 x4 R) q) i6 a8 y
3 c* T* D) i3 b7 f$ @* ~! L8 A   VMMCall Test_Debug_Installed
6 x3 Z" `$ f( G5 ~# b   je      not_installed4 g& V, w! q8 l8 p! s7 s
) [( `% f( \/ W+ |; k# c6 x
This service just checks a flag.
& ]  D5 J$ t6 v, Y</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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