About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
; r3 v( W, [7 h7 s/ q2 }4 }<TBODY>' f# o, c+ U  u8 d5 F. W
<TR>
, X; A- m3 m% [9 y5 E<TD><PRE>Method 01
! v/ }) G: ?2 Y" h, e=========! n9 _/ j1 r) f9 A5 k, m& `% J# C
8 y" k  T# C% m" e0 K* Z- X+ ~
This method of detection of SoftICE (as well as the following one) is1 A' K- W( m) }& A- b0 n& }/ p
used by the majority of packers/encryptors found on Internet.
& e/ q3 c% C' s3 Z0 K" CIt seeks the signature of BoundsChecker in SoftICE
* |' y9 J5 P( T: b" O  Q( C3 o& U! o5 S% ]
    mov     ebp, 04243484Bh        ; 'BCHK'
2 D$ W1 b, ^& L! a  B2 F    mov     ax, 04h
4 J& L5 F  y: ?8 L8 ~+ p) l    int     3      
) ~. z; v  |9 `6 Y) e1 _# O& F' h" V    cmp     al,4
) l; k6 u# Z. c4 D    jnz     SoftICE_Detected
$ ^( w# t  H. L, `
% Q+ U3 {! ~5 b% G___________________________________________________________________________
/ e3 t8 B# \4 u& q# @; E
6 o, t6 l! F' z/ z+ SMethod 02
' n5 L( _( _$ t6 V1 ]& r=========( }" T  {' v* Z: V

: t: b, B3 w* Y( E8 z4 q" AStill a method very much used (perhaps the most frequent one).  It is used" N+ R, w& [, B: W$ ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, U' `7 Q- L; d+ ^. o2 I6 ^0 ]/ ior execute SoftICE commands...7 I8 Q3 p1 h4 ^3 |3 \
It is also used to crash SoftICE and to force it to execute any commands7 z8 U! J8 I& V: _6 c; k. n
(HBOOT...) :-((  3 f$ V' t6 b# t7 g# B1 X( g! q
" B' |- r3 v" z, ~* j& c
Here is a quick description:9 U+ c5 I. E, `9 x
-AX = 0910h   (Display string in SIce windows)* m# W: `2 ^5 S. C/ q$ p
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
% d2 B8 O! _9 k' u% K( i" k-AX = 0912h   (Get breakpoint infos)  u+ c' A& H) d
-AX = 0913h   (Set Sice breakpoints)
, d. j( N: Q2 Q-AX = 0914h   (Remove SIce breakoints)$ N. v8 y4 |* k/ p( K- ^; V

7 v* G" `4 M  ^0 B! u) O3 Y- CEach time you'll meet this trick, you'll see:, J6 }1 A0 g4 O
-SI = 4647h2 \/ G' Q9 Y2 w
-DI = 4A4Dh! h5 y8 W1 E1 W  N" Q
Which are the 'magic values' used by SoftIce.7 R2 F- G- o4 u1 q3 u
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ T  e# p' |' [
, R  i8 C# E& w: e, M% E1 M4 qHere is one example from the file "Haspinst.exe" which is the dongle HASP
3 w( X! h! r- J' @2 e2 qEnvelope utility use to protect DOS applications:
% V2 Z  H" }$ L4 {) ]  Z7 x  e- q- V: F7 Y) D4 Q8 r# ?" M
# L# R; Q* z* [+ k. G( p8 \; m
4C19:0095   MOV    AX,0911  ; execute command.5 `! n7 R7 ]+ Q, G, Q! n& O9 \( w) t
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
$ l2 z! K: K5 J$ `1 Z# G& Y% q4C19:009A   MOV    SI,4647  ; 1st magic value.
. h+ l( P' N" G9 ^/ n4C19:009D   MOV    DI,4A4D  ; 2nd magic value.0 C6 d3 z9 c0 s1 _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
3 k" ]4 r. p/ [4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; C0 I, s5 A1 }8 u$ ^4C19:00A4   INC    CX
5 V% b5 W$ |( @- W8 Q* r- o% h: R+ n4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute+ S5 a5 p, Q4 [  ]
4C19:00A8   JB     0095     ; 6 different commands.
' A' A) I; ~: i2 h4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 g- d, I4 e0 V* x8 ]& a$ ~
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# }2 z5 w8 Z) H# M# q0 v6 g, F( [( A, j/ P1 ~
The program will execute 6 different SIce commands located at ds:dx, which
9 ]# i( ]; s. Y0 B5 f# Aare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% \+ b! m1 l0 f

* e; J8 v1 C/ ^  W3 \, T* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.; Q5 D2 a, _/ E0 m
___________________________________________________________________________. w5 p' ~3 W$ z% C$ ^

3 S" D% g( p9 N* P, o) I9 E$ _3 F( u7 \& f3 X! y
Method 03, \7 c  E- {( i8 w; [/ O
=========
1 {7 v0 S1 _1 }. Y1 R  i: n  P+ N( {, G8 s6 z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 d9 `% }* G1 D/ [(API Get entry point)
7 e1 P  L5 i4 }, L- w( y        
* O; c, q1 L* P4 E3 ~" @
1 s* g2 S* ?3 A, a1 Z+ s( A: U/ Y    xor     di,di
, |/ [, A" A6 a" c+ i. m    mov     es,di" V# i& B, V4 j8 R3 Y
    mov     ax, 1684h       0 L& i9 u1 O0 u8 S
    mov     bx, 0202h       ; VxD ID of winice
8 h/ ~, _; W% M, E5 D6 v  Z8 o    int     2Fh
3 w# n4 B( \5 C  `) L    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& w. J0 |! w5 w' Z) e: W" z    add     ax, di( _+ C# h) t  k
    test    ax,ax) c8 R3 g4 j) {% G$ j) s
    jnz     SoftICE_Detected$ F" Q1 y. ^( n# Z

' |2 K% P* k9 w! J% E+ o___________________________________________________________________________
% `: J3 u. C4 ^5 L2 w# c/ n7 N; v! {) q5 s: R" C- a
Method 04
, c( {9 B0 X! B) E$ i6 _* `9 u=========
  Y% }+ Y( ?$ p* Q, H
' N; k, s* z5 d0 X9 _& w# [Method identical to the preceding one except that it seeks the ID of SoftICE8 r5 V4 C# [' }( Y3 ?
GFX VxD.
( W1 n! K2 S! g9 v) t# t4 C0 l) X$ ?+ S" l3 j+ f
    xor     di,di1 D( t  s1 F6 V2 y
    mov     es,di1 d1 D5 C" O) L
    mov     ax, 1684h      
% d- d+ `2 |% S    mov     bx, 7a5Fh       ; VxD ID of SIWVID) t4 u- H5 O: H9 @& A1 ]  S
    int     2fh5 k4 @. u4 W4 O: G( U, q7 F5 g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' p3 G0 l, p; p4 H' y# L; R    add     ax, di
  i( x  {# c- S2 ?! r3 j2 {* C% X    test    ax,ax, J4 h* ^- h# S
    jnz     SoftICE_Detected
9 z4 [# E3 _+ M* Z# Y2 f
* Z" ]! |. f* A0 @, M- L__________________________________________________________________________
- m' S1 A/ R2 o' j7 A4 F" J
8 [- ~% d3 k& }  W4 O8 O6 D; M8 ^) {; n( O; Q: d
Method 05' B9 n9 U2 a6 A# S$ ~, z9 N! P& N/ z
=========
5 x1 h, K. C/ m1 d9 ^0 r2 I6 q# F0 t- T9 O6 D$ G
Method seeking the 'magic number' 0F386h returned (in ax) by all system9 `1 `0 |5 p; ^7 A2 ?
debugger. It calls the int 41h, function 4Fh.
) j4 u( {" H# M+ m' SThere are several alternatives.  . z0 C) m7 \; h4 m8 W8 q
$ f9 |* h" V' ^/ x9 y
The following one is the simplest:
1 O" g8 Z% S6 X. X+ h& r# I* h4 g. j; P- [1 f+ g9 U  D# P# Y" _
    mov     ax,4fh
/ h3 d' ]/ d8 s    int     41h$ ]. {7 e+ p2 v6 X9 t1 f5 M6 c( i
    cmp     ax, 0F386
6 k) P) U! g! t+ G    jz      SoftICE_detected
# u9 r6 S  Y/ h# o: ^: g2 ]; \5 J0 h% d  K8 `# y$ n

; m8 H; a$ [% m. m( Q& b; k* _( A# CNext method as well as the following one are 2 examples from Stone's / ]8 p; X5 K4 Z% R* s
"stn-wid.zip" (www.cracking.net):
2 y* q. x. T" V4 C! o  X2 @+ k
' M# V' I* H$ f& e    mov     bx, cs
' e+ n9 {- L/ g  {- Z    lea     dx, int41handler22 o4 N+ C7 T8 g
    xchg    dx, es:[41h*4]6 p# c& h" s1 g# u. Z4 r
    xchg    bx, es:[41h*4+2]5 }6 r/ \9 P; ^1 }) {
    mov     ax,4fh
# Z9 q3 x% S2 t    int     41h5 _1 l3 k. o* f* I+ |9 N
    xchg    dx, es:[41h*4]4 O2 x1 }/ F' b- y5 G* x3 K
    xchg    bx, es:[41h*4+2]1 f1 L2 w, ~5 l% L4 i; a8 v
    cmp     ax, 0f386h
$ b2 |' ~7 D8 g& n  T4 U    jz      SoftICE_detected! p0 C3 X7 P  f" C
' I% o& c$ j( P. z+ K
int41handler2 PROC
& N8 N1 _; N- C0 B& x0 A  G2 a    iret- \; w) }5 g$ O
int41handler2 ENDP6 r6 ^8 P  V* X2 l% [: g9 ~. c& _2 `& E

/ f1 B- v5 P0 A3 A2 m% O+ L1 B5 }8 j( O
_________________________________________________________________________
2 [0 Z# ]$ J! H: J- O% z
4 H' J! v8 H0 L9 v: S7 D
' o( p* S+ K" v% Y8 v% oMethod 066 U* Y! h  c4 e! V9 m" E7 l
=========
2 t9 V& Z8 d! i9 |- P: x/ y& }
2 X0 x- Z/ |! ^1 ^; n# v" d2 o
7 M( P" ^. j) E2nd method similar to the preceding one but more difficult to detect:: y; k3 |8 M  a

2 `$ O; H$ `$ w  ~
; G2 A" J& U& _5 F( {# K/ Nint41handler PROC
) B$ e4 I$ P, u0 o$ C( H    mov     cl,al2 z6 v0 g. ^/ G! y- c
    iret* S: @$ L: q2 `1 C
int41handler ENDP
+ c9 G: E+ C1 }& K8 Z. T- u2 M) i- X/ V% B0 C$ N0 G0 V& e
8 Q' O/ v( x% I0 S" o2 u
    xor     ax,ax, k- v. ~% O* W3 Z* L' s8 C
    mov     es,ax
- m' y- c; l3 B; W, V/ g    mov     bx, cs5 ?/ P0 x- D8 Z4 v1 R: U
    lea     dx, int41handler
0 n6 \. J6 q0 n3 S3 E0 l1 l0 Z    xchg    dx, es:[41h*4]6 Z+ A, g' P* n: i  T  k
    xchg    bx, es:[41h*4+2]
# J' L- B# }$ h- V: m7 Q$ L8 S4 c    in      al, 40h8 B5 Q$ F( A6 }5 N) O8 P
    xor     cx,cx# @4 L  A3 @- _* u0 ^, T
    int     41h
- p9 g4 a6 {9 u6 `! p1 R    xchg    dx, es:[41h*4]
- k* ~, p( T- {( F* Q8 k# Z    xchg    bx, es:[41h*4+2]
/ K! G1 F4 K# H) w: B; Z    cmp     cl,al
/ Q1 ~! _; d5 F    jnz     SoftICE_detected7 A' ~* }' L) D2 {
0 a3 F2 t5 A, Z! E2 L
_________________________________________________________________________( x$ D9 p$ l0 n

- z& V( l: b  a5 ^/ }% G  AMethod 07% s1 A/ T: g, v3 z
=========8 o* t( S0 u7 \% F! q5 @
" o& Q, b2 M* _  r1 }$ m
Method of detection of the WinICE handler in the int68h (V86)8 x8 E7 f1 b9 M% ^) K$ p
5 c! k8 F' d1 i3 s  m3 p! `
    mov     ah,43h
, P; F/ X1 ^; I: r3 L9 S    int     68h
+ u# n$ `2 W/ p9 I0 m1 ]& i    cmp     ax,0F386h
9 F0 H- F" |' W* g    jz      SoftICE_Detected
" u5 i& U, T% h! |
6 s8 N0 U5 s9 e2 O! n& Z" @" i8 _" q1 ]  o
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, d) @  ?. D# r) h9 Q
   app like this:
' b  e  D# y; g6 K7 k
: H& B7 M5 D" h/ ]2 V& [# F   BPX exec_int if ax==68
. W, W6 x% T' b3 U. k# p0 k   (function called is located at byte ptr [ebp+1Dh] and client eip is# A* k: m, ~0 K( r
   located at [ebp+48h] for 32Bit apps)% p8 p& o' P* m. y
__________________________________________________________________________8 [3 \. C; v  h% I& H; D% @) n. j

/ g- n9 W  D" J5 j9 j8 s7 C
5 o+ ?' y  u2 q& W# ]Method 088 I  e+ d4 A# l0 R4 g
=========
4 t1 b7 a$ u7 Y, i' S, m4 i: y- {2 t: v3 y, X$ P+ R
It is not a method of detection of SoftICE but a possibility to crash the9 F  t1 g6 w4 k: o2 W4 x
system by intercepting int 01h and int 03h and redirecting them to another0 j2 N0 }2 G# m3 n. z- M" I7 f& V4 p
routine.' o6 H* a: C0 \. {! Q7 ]$ B4 t
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points& k/ \2 ?! }, t6 Y2 u1 \2 ]" [
to the new routine to execute (hangs computer...)
' p$ S( E( T2 M: Y" H1 |4 S6 |' A  {1 h7 I
    mov     ah, 25h. \" r2 [# Y9 V1 _- K% s
    mov     al, Int_Number (01h or 03h)0 M3 p: W2 S, E. O  _' D
    mov     dx, offset New_Int_Routine; k5 \; ~( H0 k0 O2 B* s4 Q& @4 m! D' N& H
    int     21h
- @) k+ D4 Z9 Q' k& U) t
0 F, m9 w+ q1 I, @* C0 c__________________________________________________________________________4 \/ W- r" W$ p% `. ]2 e3 [
, y* w- E" h# o  g- E- x5 S' b
Method 090 Q7 ~5 a- F. a4 p
=========( Z. q+ N7 p' C2 k' l4 }; B6 h& H, ^, f# n
2 w4 K& y/ `3 _1 R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ E% y1 a8 D% _( j2 Qperformed in ring0 (VxD or a ring3 app using the VxdCall).2 h( V. M1 d* z- u
The Get_DDB service is used to determine whether or not a VxD is installed
5 W# B- l! u  Qfor the specified device and returns a Device Description Block (in ecx) for5 Z" ^4 w8 Y, ^8 s: Y5 k. D) y
that device if it is installed.
7 T* Y2 u( D# Y! H& J6 I5 _- K7 c( ^9 L" x9 f
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
- k8 C# v* |  Y/ j* f  e, @   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 g. U  X: z3 C6 d9 Q   VMMCall Get_DDB5 E" z) t7 N3 X4 ~  X! [8 _4 L
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# z' t" p6 l/ S3 \

7 l7 r8 w8 U8 e. A$ T; C. g! N% LNote as well that you can easily detect this method with SoftICE:9 a5 m, W7 ?5 v  @6 P( }
   bpx Get_DDB if ax==0202 || ax==7a5fh
# i2 N1 j1 Y3 F% `+ s& W
5 d- Y1 N5 ?  M7 [__________________________________________________________________________$ d2 Q# g8 z. J

& A6 S" ~2 e% G4 BMethod 10
) V# l! [9 r8 q" m6 x1 N/ y=========5 V) o/ v* v. c* `; Z
- F) i& r4 `* R! U+ m
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 P1 L! P9 I$ o1 b
  SoftICE while the option is enable!!
$ [$ a& B) [4 {2 t7 R, |. b# ]* [2 I
This trick is very efficient:' M' q0 A* A1 @" i  M0 g) H! n
by checking the Debug Registers, you can detect if SoftICE is loaded! t# f. q, [  ?8 g
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 l6 [9 }2 D6 T  p- @: }
there are some memory breakpoints set (dr0 to dr3) simply by reading their8 H6 n& S( F, z' D4 Q) {# Z
value (in ring0 only). Values can be manipulated and or changed as well
& r+ e( u* l% `. S6 f4 h% I(clearing BPMs for instance)/ ?% X" j# C) W$ M# d' W- O

( B/ x2 `/ _  P__________________________________________________________________________
2 ?2 U4 g6 F. o. j6 n$ @' b& t9 D( x& t) N7 ^1 r, B
Method 11+ E2 O+ I* s7 q/ ~
=========5 k$ ~+ j/ ]5 u( w

2 r) y% Z6 `. z* ^This method is most known as 'MeltICE' because it has been freely distributed3 b' K2 O2 @" w/ l) g& l
via www.winfiles.com. However it was first used by NuMega people to allow* r' X. N4 q" w5 R$ Z1 ?; s
Symbol Loader to check if SoftICE was active or not (the code is located( D+ N& d- S# P4 N* x: V( V
inside nmtrans.dll).
$ l5 Q% z( H  T* j$ G- ~% F- ]" H7 f
: v. I9 s+ R8 X$ x$ S4 \9 ~The way it works is very simple:  k; a0 ^0 W4 v. y8 Y/ K1 F
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% i5 S) j3 C0 iWinNT) with the CreateFileA API.( Q. _7 g2 S2 y: F

0 D/ t; o& H% T& C& Q; }Here is a sample (checking for 'SICE'):( W& N5 g  Q& K  n( j

$ P/ }  I' s' W$ B) ~) TBOOL IsSoftIce95Loaded()
7 i  p9 r0 P9 g# J{: [' s; ~& s1 I% g" C) `/ ?; `' _
   HANDLE hFile;  * q( q8 A: J4 }/ G) J, U' @7 o/ t
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 J1 R7 Q# B8 d
                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 S+ X: }" Y) L/ k$ ]
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 s5 k4 s% l& D! o! ~
   if( hFile != INVALID_HANDLE_VALUE )' ]# H) k+ r8 [9 e  E2 p
   {3 C. k) t  o1 N" ?% G7 g, b" i
      CloseHandle(hFile);' h4 ]; h. j& J! @+ p4 }
      return TRUE;
7 _9 z4 A" {, `3 X; v   }6 K% t- n$ i" K  B8 P7 |
   return FALSE;- x" V% i' b+ K: q( _4 N6 i
}" Q, ^9 z3 F5 _) L1 r
3 p$ I( z  e0 {6 Q
Although this trick calls the CreateFileA function, don't even expect to be+ R" z, S0 [& D- Q8 [' g& g
able to intercept it by installing a IFS hook: it will not work, no way!) l* A& `2 E1 B
In fact, after the call to CreateFileA it will get through VWIN32 0x001F9 M7 B* X5 {* _" r2 a  O8 R& l6 y
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& b) o0 \  \/ g; {) ]and then browse the DDB list until it find the VxD and its DDB_Control_Proc/ ^, E8 I. `* Z+ l; [
field.+ x& x5 G3 _6 M' B; R
In fact, its purpose is not to load/unload VxDs but only to send a " U7 c; [9 A, ]5 o; M5 r0 J7 l. h
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* R, b( X  {( A: h& e7 F
to the VxD Control_Dispatch proc (how the hell a shareware soft could try9 F0 M9 ~5 _6 @( ^* s9 ]9 i
to load/unload a non-dynamically loadable driver such as SoftICE ;-).* ?& L9 H* p5 B  T( ~
If the VxD is loaded, it will always clear eax and the Carry flag to allow; ?  k% s6 P* u8 x. T( F+ g
its handle to be opened and then, will be detected.
" y/ C6 I0 p/ q) e' n% [4 d9 b2 HYou can check that simply by hooking Winice.exe control proc entry point1 `. P. e! ~  b/ a7 X" q/ r% U
while running MeltICE.
) p: B, f1 ^4 v' f' C
5 [$ ~5 N& m. I$ _3 h0 k# G; o% ?- s4 C" Y: F6 U
  00401067:  push      00402025    ; \\.\SICE
& q: [, x2 T' [1 [- t  0040106C:  call      CreateFileA0 N, I/ f' j# E" _9 c
  00401071:  cmp       eax,-001
& W8 g* U2 @" s  o2 a/ ^5 G  00401074:  je        00401091
" {+ M+ B3 X% W- m- f' a1 a4 H2 A- y+ Y5 h! m! @" I7 W- h
( J- u2 Q% s- v. x! N7 t# {1 k6 w
There could be hundreds of BPX you could use to detect this trick.; h7 \6 g) g. r- O: [
-The most classical one is:
$ [, g" l# v% f0 `7 b7 [8 q* _& D: }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
4 I# b- b* ~$ ]" g    *(esp-&gt;4+4)=='NTIC'5 {. w; a9 ^- |: r8 ^% F1 t
6 H2 g9 y; i- Z
-The most exotic ones (could be very slooooow :-(8 ?, X  \# l) e0 L
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
; Y* m' D7 l% |1 \7 I; @     ;will break 3 times :-(7 k5 ^& s' |+ b3 F/ ^

$ J0 a3 T7 l1 I4 Q8 B  B5 Y; @& F-or (a bit) faster: 2 p2 a. a' l8 p+ R3 l/ b# d8 _+ d
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 X& }' V4 h' Z# r6 {: D# j  I
/ |9 y' b9 W1 S6 B   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  6 I/ L7 a) {2 H( m' R8 C
     ;will break 3 times :-(
3 W4 I/ Z) S9 T/ O! A/ l8 d( y% a7 Q8 U! }' u1 Z' r2 X
-Much faster:- f6 V$ X$ m( \8 _
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! p+ g: X. S; T& b% Z% l

0 f9 D5 D% x" m1 T/ l1 oNote also that some programs (like AZPR3.00) use de old 16-bit _lopen7 N5 b  n6 y+ j# L0 N# M
function to do the same job:# U( g' ?% ?( t- O

: o( h3 J- e- Q4 j! o' d+ p8 E$ m   push    00                        ; OF_READ+ A( r  h3 N! e! [' t/ M& G( `% ^
   mov     eax,[00656634]            ; '\\.\SICE',0& R0 Q7 A4 @7 Q7 F3 v
   push    eax8 N! b8 q, U5 ~# S
   call    KERNEL32!_lopen7 n  o" ?1 R! ]0 v- a  h
   inc     eax6 G; N8 G5 X" c2 I
   jnz     00650589                  ; detected
& M- L8 d6 s. P4 F   push    00                        ; OF_READ
) I/ p1 u( e/ G# u# N3 I: l   mov     eax,[00656638]            ; '\\.\SICE'
' K' Q% ]' t1 q5 ^" [   push    eax
* ]0 D( m; O+ W: u2 o" S   call    KERNEL32!_lopen# y; A, l9 |" G# S% ?. a- h1 M. h6 z
   inc     eax
3 x0 f# ~/ @* I; F; a3 L+ X+ v8 K   jz      006505ae                  ; not detected
% x4 n& m  |4 I3 D) Z& {# {! b# E  `6 p, L! D, C0 {  b

0 U( i$ i9 P+ \2 p__________________________________________________________________________
& V& o% \+ S; \6 X3 @% h1 H: D. @9 `3 X$ M" L3 l# G
Method 121 ?/ ]3 O3 H/ f' i- Y, H( d
=========) U% E" x9 D- {8 P
; `' F$ O. X# A/ }3 O
This trick is similar to int41h/4fh Debugger installation check (code 05( i0 S7 P1 _/ b/ X3 i" Q. `, A
&amp; 06) but very limited because it's only available for Win95/98 (not NT)3 N" L9 ]- h% m; C/ C
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" s' J. k) T& m8 k3 d8 _" Y8 A; c9 N- w8 j& Q" R- p  ]) `
   push  0000004fh         ; function 4fh
! ~6 c% \# W# x  _! l   push  002a002ah         ; high word specifies which VxD (VWIN32)( M- V8 d  z' N# W. E
                           ; low word specifies which service
  S: ]" p/ G1 U+ Y: C% g7 G3 Z                             (VWIN32_Int41Dispatch)( r2 i1 Q% ^8 |
   call  Kernel32!ORD_001  ; VxdCall& F) v# p  j& u* d, k6 T; c
   cmp   ax, 0f386h        ; magic number returned by system debuggers
: ]0 @, E2 a4 f9 _% s3 i; f   jz    SoftICE_detected
9 \& r+ q. N, }9 _) V! {( @/ Z" |8 ^1 Q7 a7 E3 ~3 S6 z0 l" V
Here again, several ways to detect it:
: u# V: x6 h) c$ N; Z: `6 N7 b$ ]- d
- x$ R0 S9 {$ H    BPINT 41 if ax==4f* G+ O2 g% U; p

* D8 ~. t1 V( B1 b/ s    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one& Z: ~# m9 N. F3 N/ Y4 u

& N! c+ H" n" _% ?& ~" L    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A7 r* Q3 {% {2 {+ y1 A
4 n, b0 x$ q# b( h8 U
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 K7 k* b+ E' Z0 b# S
5 p7 d7 d& I7 x& T' T
__________________________________________________________________________( H, B5 O) g, ^1 C" X

0 F& s0 p2 a* k! \% Q, K+ ~Method 13
1 ], a& O* {* w& q% \9 j1 {' D=========
2 D$ N+ K% U) J0 ?0 i. A9 U" w% M; G* P/ x2 |& [3 N
Not a real method of detection, but a good way to know if SoftICE is
* R! i8 T9 P+ Z$ J& }+ U; Zinstalled on a computer and to locate its installation directory.  m- F2 ]" s7 X, @# w* o
It is used by few softs which access the following registry keys (usually #2) :
3 ?! r3 E# b: @  k: K# t9 h! B% O$ l" ^' ?/ c
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% O. R( N3 m1 t( }/ Q3 j5 o
\Uninstall\SoftICE) b- G: j7 A. Q& g, w9 G/ P3 ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% g/ A$ e& S- G* h9 Z  c, [, g0 C
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 M+ J+ H' ^5 @& i8 z: }\App Paths\Loader32.Exe; P! B" M7 Y; T8 t5 |: m

9 n! |3 w( C3 x5 Y/ |# ?. g5 |* z: \: a1 u! S* C1 z
Note that some nasty apps could then erase all files from SoftICE directory
% Q0 x, E! s& c& R$ \. C) c(I faced that once :-(
/ C0 M; P/ e6 G/ C# g7 }+ J0 W/ U* j" ?! r, y  @& N6 B0 {
Useful breakpoint to detect it:% H/ ]) z- y) j" p* ~4 T

4 K4 p) U" m, T( W( O     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! M6 U1 a$ u% l4 H6 c% v" |% U- u1 s( H
9 ^' E6 e8 h- k# ]& @__________________________________________________________________________4 d4 Q' t& D& z/ W& H5 t4 L

2 T; o9 d) |7 ^% _6 H" d$ K  J- o
' @) r% p5 x+ N8 s& jMethod 14 4 d8 A8 E/ v  D% b5 w7 u( [
=========- L6 r! F2 N, [0 G8 g5 S
. B" [# y; `5 S- P
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose) j) n8 W) v9 Y2 T- l7 o9 f2 R
is to determines whether a debugger is running on your system (ring0 only).
& @% K: U1 a) d  Z0 L3 V- F$ e% |* H3 h9 f" `
   VMMCall Test_Debug_Installed$ I$ i+ H7 c4 z  X; B& z
   je      not_installed& y- a- R5 Z2 i- t8 Q/ h' i
" M7 @. z5 {6 X
This service just checks a flag., l9 h; ]+ N! g
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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