About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 M+ w1 S( p6 E
<TBODY>' U2 v8 i" B/ f
<TR>
: |: e4 L8 s9 D5 p1 J7 Z<TD><PRE>Method 01
: Y' F+ n& u) y/ W4 t, x=========+ L9 C( i6 U9 L& L' @$ n: z
7 s/ o3 i$ P7 l7 F8 m# I% K# ^
This method of detection of SoftICE (as well as the following one) is
( S( Z# H& G4 _+ [3 }; W6 U2 [used by the majority of packers/encryptors found on Internet.& C5 ^6 q+ [1 D: l& b# X! K) s; y
It seeks the signature of BoundsChecker in SoftICE* e1 t- \- y& g

( G5 `3 W* @% i7 M    mov     ebp, 04243484Bh        ; 'BCHK'
3 Z" f' B1 `" N5 ]+ K2 O1 I    mov     ax, 04h
; C, L' N4 D- L    int     3       " B. {+ q$ U6 J1 [
    cmp     al,4
: v" G/ [6 v3 k2 g; K( H) N    jnz     SoftICE_Detected+ |. u. `5 M6 v0 `7 j% P

. _- Q9 m. b9 p% ], j5 |% t___________________________________________________________________________5 Q$ Q# F0 j0 o4 ~& \
4 f4 X) z# C0 x9 }
Method 02& Y  D; v/ x1 W( b
=========; W, S% _/ \8 g) k: H  x
& @' f8 J" @, b+ a: A0 K! h
Still a method very much used (perhaps the most frequent one).  It is used* n0 L( D: u7 }1 }) H' u; q; t
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,; P( O$ y2 \* U$ t: {8 h! W
or execute SoftICE commands...6 p  I1 w* P0 N2 {5 n# p! j
It is also used to crash SoftICE and to force it to execute any commands; X( K! c9 f: K  A, H# o
(HBOOT...) :-((  3 d$ p$ i5 B2 }$ {$ P' B2 f
  `$ y: w( x. _% m- S  R3 t
Here is a quick description:) v. S! k$ ?. H+ O
-AX = 0910h   (Display string in SIce windows)
+ |0 Q) a' P- f) N-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)2 Q& t# h# y) x. N4 t
-AX = 0912h   (Get breakpoint infos)/ V' o0 t$ W! v2 k$ p: I
-AX = 0913h   (Set Sice breakpoints)
; m" _" x8 s! h$ u) z-AX = 0914h   (Remove SIce breakoints); [! Z. l& G9 H- ~" J/ x4 y4 b

, I  d, F( z' ?% b% zEach time you'll meet this trick, you'll see:
6 b# ?& f/ X) P. W# i-SI = 4647h
9 j1 J/ D  p" T* y/ x( b6 t$ k1 Q-DI = 4A4Dh# M% @, P5 E0 G+ @5 D  @
Which are the 'magic values' used by SoftIce.) r/ `6 v  c) ?3 O) `1 S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( L- s5 A. u/ g
6 H+ G( ^( x7 |
Here is one example from the file "Haspinst.exe" which is the dongle HASP
# b) K4 Z7 k6 E4 B, ]' K* O( X6 bEnvelope utility use to protect DOS applications:
/ V! d6 f8 D1 D0 e  Z' T) u- ]2 P3 x# |5 V8 d
/ l8 o" w% P4 [) c- \2 l4 a
4C19:0095   MOV    AX,0911  ; execute command.
5 p& A4 r3 J) `9 J4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).* |+ H! t% C2 D% ^
4C19:009A   MOV    SI,4647  ; 1st magic value.* v) Y8 ~# K9 O( |; U1 `9 ?8 x
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 |, o* v) E3 c& ?! K% H' _6 O0 A
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)& `5 t2 H2 T  ~% c
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- @& X) J# Q  b! s  k( U  {; z$ Y$ ]2 Y! Q
4C19:00A4   INC    CX1 g; ~, [  s+ Z, r4 Y
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" P% Z" @# X* e: g4 u
4C19:00A8   JB     0095     ; 6 different commands.
2 U1 y( u5 G  H4 o4 ~  s4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 i$ Q  u! g1 \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ Z2 N+ [: F% {' `1 v

" T7 }$ J3 w& e7 Q* u" |5 Y+ aThe program will execute 6 different SIce commands located at ds:dx, which- ?9 w/ _1 k$ o. g, P
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. m# n0 u" G" }, X4 |5 C3 \
; r" X: C. ~+ K2 s' q+ f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.  d6 q5 S$ _. n% W
___________________________________________________________________________2 B) Q9 M/ P; D7 J

+ f% l2 `+ C; p0 ?" X! w8 ~3 t3 V7 h
) x6 J. T: i6 D  MMethod 03
8 H( a8 H5 K7 Z4 Q7 ?- u=========) j* ~# t5 W- e. g
9 h5 E; B% V% i6 j" H
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; w" w1 X2 a8 X8 v; i# E: U/ p(API Get entry point)2 z3 @! J' |) n. q6 A
        ' C. z# s1 I9 [0 N) O- u

9 V  K' j& A8 W. e    xor     di,di5 c% c- u0 A' q! V% F' J" u, L" c
    mov     es,di
/ g- V, }, V/ N: k, t# B2 Y    mov     ax, 1684h      
: d/ j. r! o. G9 e( n2 O    mov     bx, 0202h       ; VxD ID of winice( [0 e, |' k) h* x, I
    int     2Fh, {% R% C& x4 b+ P( M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  |8 W0 J: y  r  i1 s# K: J    add     ax, di
7 Y. u7 [6 E1 \( y7 @0 @    test    ax,ax
9 d; Y2 J* _" c! f# [! J    jnz     SoftICE_Detected
" j* m1 b" a$ J* c* q6 c) w( Y2 f" ^+ z8 x& Z0 h
___________________________________________________________________________
: `0 k' J" E2 y* A0 u' V
; b& M! y" P7 I. jMethod 043 K/ h% o% R" t& }( C  D$ T. d
=========; k# b) D/ J% e5 k
2 c9 a+ C' N% L
Method identical to the preceding one except that it seeks the ID of SoftICE% z6 b- D4 [+ n: J1 m, t, N
GFX VxD.
! W* Z6 `4 }/ S5 m: ^$ X+ D- p$ M/ I7 q0 K  I* i
    xor     di,di
3 X6 t7 J( U" S9 @: p+ G( m    mov     es,di
& A0 h* l3 v5 y0 o6 L0 w, f. @    mov     ax, 1684h      
7 a: q* n; |  c    mov     bx, 7a5Fh       ; VxD ID of SIWVID
* W* `: }* {3 K; z: E3 E* N    int     2fh
; X' y: Q9 ?- [+ B! [* ~$ o    mov     ax, es          ; ES:DI -&gt; VxD API entry point) S) Y' P* }9 K$ Z# X1 M" o& W4 v
    add     ax, di
/ m. G# v, ~, T    test    ax,ax
" }+ y# u# @2 P3 I$ [8 B    jnz     SoftICE_Detected
! Y2 h2 K5 J. {* {, x$ n- M% \4 R- r3 e% C
__________________________________________________________________________
+ E) B% l. E# u7 s/ K4 M$ c6 V3 K# l  m9 ?1 ]

( s) w* Y9 ?4 x& o2 M2 R4 ]Method 05& k7 U; O/ O2 {1 l7 e
=========6 ^# k+ Q/ K$ t6 E* h  a

1 F# X% F; [( s# S" W: f( iMethod seeking the 'magic number' 0F386h returned (in ax) by all system, f7 O8 K" x/ F' K1 `% b9 e! U
debugger. It calls the int 41h, function 4Fh.
5 f6 D! V; _8 c' CThere are several alternatives.  & f% D+ n$ Q) Z
8 v: I1 k2 x& r; r* [
The following one is the simplest:
$ B6 }3 u0 Q  F+ A+ T7 P
5 B" |# p. m8 U9 u- z1 D+ {    mov     ax,4fh& j3 \/ [% L  ]' m1 ~  _
    int     41h$ _! Q/ r0 n% w/ X
    cmp     ax, 0F386
3 V: ]& N- |& T. l' x/ v# @    jz      SoftICE_detected1 `3 K. l. }5 h& c/ p: O; H. W

3 }, P* Y$ k/ C) t( Y& k) s! z+ P4 {4 Q1 {1 v) g+ q, `0 k( E
Next method as well as the following one are 2 examples from Stone's 8 h4 j- X# @8 `4 M0 b- @
"stn-wid.zip" (www.cracking.net):4 B' N& i9 \# z( ?' G' k; i! [/ G

: t2 F9 q1 X- u" {* a  O    mov     bx, cs7 P' ]+ Y4 ?! H  P! C6 @$ {( U
    lea     dx, int41handler2
% J* i5 f. J/ R$ y: J) {    xchg    dx, es:[41h*4]( |  Q/ n2 i+ g0 q
    xchg    bx, es:[41h*4+2]
; r2 g2 }/ J- Y$ l; b! r    mov     ax,4fh
1 j4 X* [" ~, ]0 ?' M. K    int     41h
5 }. Q# @- S* t5 k1 |: D) {3 P    xchg    dx, es:[41h*4]
/ E( f. Z7 Q! }7 C) Q    xchg    bx, es:[41h*4+2]7 R8 v& C  }9 \9 o$ I9 {
    cmp     ax, 0f386h% `# E- J/ @2 N4 Y& n: J, E' ?" @
    jz      SoftICE_detected/ N9 _1 Q0 ]. Z+ R
( j% Z+ `' I; g! x; ^1 U$ S
int41handler2 PROC7 c* C1 {# r. _5 @
    iret
3 E8 ]* D3 k4 iint41handler2 ENDP
( [  q$ W: v- Y8 l7 Y& M3 G# d4 P9 l, f1 e* y( W5 q% I

2 _0 ]: t2 w3 J_________________________________________________________________________
/ {5 e; q% c0 O  l% k6 N
" K3 _0 @" s6 N4 ]8 \! @- l
6 }# C  O& T& l# @3 x: EMethod 06
, Z# @/ H- J3 U+ u- A=========
3 N  h3 w2 b  K# X( S1 H  \+ G. a3 L" A% ^1 J' Y0 T/ }8 E6 N
7 e) |- ?  w9 S! N5 y9 i
2nd method similar to the preceding one but more difficult to detect:4 _' B, X9 ?( ]! s$ @3 f. |( c+ u

, f0 M1 Z- s0 Y4 o1 N) [
1 Y/ K. k& t/ ?2 r+ y$ yint41handler PROC+ S4 o: J. ^8 f. `. Q& |$ M* X8 H
    mov     cl,al
6 W% l, m1 e4 S0 Z4 Y$ i8 n0 C    iret# F+ @& l$ q1 y/ Y5 t8 q
int41handler ENDP
1 }  K9 B2 p6 q: S% T6 N3 X3 ?. W3 E* W+ q

" N  J$ u/ x! t9 y# F; C    xor     ax,ax4 E9 x2 a" t9 z% y# N# e
    mov     es,ax
$ H; _% z; ]5 w) [3 D: g    mov     bx, cs0 G, k2 D  T! _  {( q, n
    lea     dx, int41handler
8 L( c7 t$ `7 J1 T  g" J    xchg    dx, es:[41h*4]* U* o' i6 P# [! a: U  o8 ?+ H
    xchg    bx, es:[41h*4+2]# _- K" _7 N1 T+ o- w5 [
    in      al, 40h
) i3 c6 H6 I6 {    xor     cx,cx- G% q4 @/ n, C0 t8 t/ @
    int     41h7 N3 l. F' l0 X. F
    xchg    dx, es:[41h*4]
2 _+ l# `$ }2 v8 L1 w# x, k    xchg    bx, es:[41h*4+2]' V6 Q; m4 A( A9 ~" U
    cmp     cl,al: @4 {% D7 x4 g" x
    jnz     SoftICE_detected
) x# r1 L9 T# N- Q9 M4 f8 ]' v, p( e; Z7 {
_________________________________________________________________________2 I" `; w$ Q6 Y) w4 i% w, J% L
# t) L6 f! X; K' @: e  \3 ~
Method 07$ P! I+ X$ D3 s! j$ L8 r
=========
9 B/ H$ i' I, m  c& x: C& y# `% g& q# ]9 L
Method of detection of the WinICE handler in the int68h (V86)
& q- S- `6 `. _, H1 {5 c/ Z/ q
& F6 ]2 H' S) D- N    mov     ah,43h7 G" q5 J$ X; ]2 s  j
    int     68h, {; h3 g1 j, @( n! n- q
    cmp     ax,0F386h
8 M9 b/ p* [4 a- F    jz      SoftICE_Detected. d$ N! k! j7 d! C) j+ w) G

' a, m3 G5 ^3 T0 Z( K2 |+ O
+ R# _/ N5 N, Z0 \, s=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit- N+ c3 A; B6 {6 `$ ?! y
   app like this:  V/ E9 k% Q9 B- Y
4 V! h0 m$ m5 `; B0 Z; _3 O1 H& {
   BPX exec_int if ax==68
, g# z6 d5 l: x- \! |( {& ]+ L   (function called is located at byte ptr [ebp+1Dh] and client eip is
( ]/ y% k4 B5 U# M3 o' v   located at [ebp+48h] for 32Bit apps). p1 q7 ~0 C0 p; T4 ?
__________________________________________________________________________' Z# |" B8 D! m2 M- C
/ W; o8 c, {1 H# D% [0 F5 D
: V1 |2 B2 v  d% V9 E
Method 08* n0 B! q! Q" K8 y5 ~& d
=========
0 [& t6 ^: y, b
8 `3 t1 ?7 O0 ?* @! y! l" uIt is not a method of detection of SoftICE but a possibility to crash the# C* T9 |9 E* y4 ]; W( g
system by intercepting int 01h and int 03h and redirecting them to another: T3 `. X( W- U
routine.# a* s/ h: C9 ?/ O' S
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
* j/ k- c4 c/ t6 d8 {to the new routine to execute (hangs computer...)3 r( r! V1 d( s5 H) k" ^
' `% n) j! ]$ M
    mov     ah, 25h
+ z4 G0 C0 ?: ~" q' x1 N    mov     al, Int_Number (01h or 03h)
$ s( [- g8 }7 S9 U" ~    mov     dx, offset New_Int_Routine
* {3 ?; x( ~$ r    int     21h" _( r* _: ^- s" U) x
( N* f9 k+ P2 Q& a4 w. r  ~
__________________________________________________________________________
5 u5 j. c# L3 }1 F$ G( Y9 U5 y% ]5 l6 q$ f2 C6 s/ W
Method 09
, s5 L5 h$ n! n# H( e) I=========: Y8 h- B! ]. Z8 @7 Z

" y; s2 h! G' T5 T2 |1 HThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* X0 h  t' i0 K! g6 L* ?; D6 r+ s
performed in ring0 (VxD or a ring3 app using the VxdCall).
7 Z1 u9 Z$ u3 TThe Get_DDB service is used to determine whether or not a VxD is installed1 `; [2 j: d+ m& L' X7 {
for the specified device and returns a Device Description Block (in ecx) for3 D% F  `6 K3 t2 i6 _
that device if it is installed.$ h6 ^; v' U3 l& V! Z+ `

/ v2 `8 i& a9 ]2 I: s2 J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 y1 `* D  d/ E1 f! G   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* j; G& p% `- L' S& Q  A: N5 y   VMMCall Get_DDB/ T+ V5 P( H) [7 Z6 Y8 C
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. A$ ?/ V3 x$ X; f" W
& C' {1 D0 A, r' _Note as well that you can easily detect this method with SoftICE:! m' h" H, S( d
   bpx Get_DDB if ax==0202 || ax==7a5fh
- I6 m' F& K5 U1 U. W$ N
0 \* t' Q2 N8 i/ L__________________________________________________________________________
! s9 x* B! b, h6 e" E; g1 i- |$ ^2 V* ^
Method 10
4 l& I  g' O8 N* b4 G7 }, k=========: w9 s) M. \% w7 Q" N
8 {7 g0 f" Q" m% m
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
+ ^- x+ F* B0 o. p& J1 \& H: v5 n# a  SoftICE while the option is enable!!
' u! [- S% ]  j* k+ U" d5 G" w6 U9 L# O
This trick is very efficient:
- X+ C' l, F1 a5 O. d/ yby checking the Debug Registers, you can detect if SoftICE is loaded1 a$ c! T% I2 ^7 K
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
" r/ Z' S1 s! I% Bthere are some memory breakpoints set (dr0 to dr3) simply by reading their
7 s! n& d0 }, Y- H2 v/ l& e. F, C! cvalue (in ring0 only). Values can be manipulated and or changed as well
6 ?, ~0 V0 t9 s1 \" L9 p(clearing BPMs for instance); x- e, U) J: P8 E, V5 R6 K
9 E* U6 L1 ~3 C1 S
__________________________________________________________________________6 j  {& G4 K, [

( t; Y2 P; `: x; TMethod 114 L' n2 ?! w7 i  K+ y
=========
# v1 x3 n$ {1 ~0 J) ^5 W( l. d6 @6 K, v
2 P4 x& H) B) H$ L0 S6 ?# _6 U) {This method is most known as 'MeltICE' because it has been freely distributed3 z! a" p+ V- i( @8 j7 W# @  z% [
via www.winfiles.com. However it was first used by NuMega people to allow9 `; I- P) i) r* U
Symbol Loader to check if SoftICE was active or not (the code is located3 I$ W/ b, \" _. z/ {. x, x) n
inside nmtrans.dll).; D9 p  z+ ~0 _* N7 M  \

& s! f/ _' z0 {8 ?  T$ x! ?The way it works is very simple:0 ]: L9 C0 Q1 o) p1 }3 B
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; w" ?( v+ j: S* D) IWinNT) with the CreateFileA API.! n# m0 ~* h& o. `$ B2 D% r8 p, y

% s7 Z/ y# T  q( h/ n, `& f# pHere is a sample (checking for 'SICE'):
0 ~, K$ R( _- b
: b6 ]- u# A% o; KBOOL IsSoftIce95Loaded()
2 P5 @& O0 x1 Q$ E2 f{
% g. ?( d5 c! i- o2 w) i, t- F   HANDLE hFile;  
) |, i3 o8 x! F! ~$ y, L( W+ e! t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,, K# F0 y6 Y) i
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 ^3 f" Q1 j& d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, v' W# V: E, U- j' R7 t2 B
   if( hFile != INVALID_HANDLE_VALUE )/ l4 z# }& Q. s7 A
   {3 Q$ k! r1 s" p
      CloseHandle(hFile);% ]# s6 M: d0 H. H
      return TRUE;
" x  U; x1 s4 y: B" E& s   }
( B1 H% x5 M: s2 D& [8 n) K   return FALSE;
" P; ?; |& {7 ?2 c% U, I}" y2 a3 \& V; P7 G  }  ]$ i4 [
2 n3 a! u! b5 k- Z4 c: w0 r0 ]5 M
Although this trick calls the CreateFileA function, don't even expect to be
- X* k7 V; ?& E0 d- W" w) C  Iable to intercept it by installing a IFS hook: it will not work, no way!8 B6 {! h; k5 d) y& g
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 o' G3 [8 d  V: [" Xservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
8 O/ k$ s: m0 B9 F0 Tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 j1 f+ p2 N9 g% u1 Z4 |: vfield.
% B5 v$ c* |; J: ^6 }5 w. p+ t) \In fact, its purpose is not to load/unload VxDs but only to send a
4 `2 Q9 ]$ b+ i! N! Y2 iW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
6 V& X, ]2 I& k# k5 V* \7 I% E; |to the VxD Control_Dispatch proc (how the hell a shareware soft could try& P, ]' y) Z( B7 ^5 \1 D
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ L) A4 N' E3 i8 XIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 w( v, g0 s# Q* d# ?! z, S- z
its handle to be opened and then, will be detected.2 m( F" ]! X8 C( u
You can check that simply by hooking Winice.exe control proc entry point
9 D3 _- E; l( }+ d( Iwhile running MeltICE." w8 t- T. B) }; U6 b

8 U0 P; l7 y0 O7 z$ G) w% s1 g6 u- t' p; C4 D
  00401067:  push      00402025    ; \\.\SICE
7 _, d! h1 [8 T8 L& F/ \# X  0040106C:  call      CreateFileA
  W5 e9 g/ S; w  00401071:  cmp       eax,-001$ ^" d* z2 Y* @  n( S: N% u
  00401074:  je        00401091" A- w1 I$ G3 Z0 O  m" F5 u

) |. S7 Z# x2 d& |6 ?7 v& b, W7 ~. H, j5 L3 B+ C
There could be hundreds of BPX you could use to detect this trick.
; k3 C: Q% s7 S7 _2 j8 p-The most classical one is:
7 O) j! |2 z. R. o6 A: f+ t  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; l$ `5 {4 U2 z3 g. D    *(esp-&gt;4+4)=='NTIC'
, e( ~) H9 M$ h+ m: A: q$ W4 F: G+ p. y( t8 u) V- a' M, ~  O' z/ g
-The most exotic ones (could be very slooooow :-(" u4 K5 \: _' D1 y; q0 K/ Z
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 w( r% X8 ~' n% j" x( e" y
     ;will break 3 times :-(' O/ U" ]8 n* o2 G2 l' f
4 O& o. R1 @5 s- _) Y3 N7 ~* e
-or (a bit) faster: ( v/ T9 @; ?3 I
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 J4 O# I+ A1 |
+ K* x0 e# l: s; ?! y7 q7 i* w  L   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
/ E8 ^, u- a" {     ;will break 3 times :-(
  v% z% q8 p. I+ I0 g. S) V5 B7 e
; `: A6 }' U4 \( d7 j6 F& {- |-Much faster:5 O% P# O9 l) L: z
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% F$ P* R/ ~- f& K3 v$ Q5 Q. N# @4 C
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ @& J: ]8 q( @$ _3 ]function to do the same job:$ d: ^7 U. Z2 Y" k$ @8 G
0 n1 d2 _2 _% O  ^
   push    00                        ; OF_READ
1 E6 R, w0 S& n0 }   mov     eax,[00656634]            ; '\\.\SICE',0
, W! V$ ~' S. v, y. s0 M* r6 U   push    eax) b3 E- ]( V! Y$ g
   call    KERNEL32!_lopen: {8 G% [% h5 A
   inc     eax  _# m5 x4 V  w4 U1 ^4 P
   jnz     00650589                  ; detected& v. Q2 p- t2 O$ `* h
   push    00                        ; OF_READ7 g' x  `0 v4 a: K) n  I
   mov     eax,[00656638]            ; '\\.\SICE'$ g/ K* q( I# h6 [0 T# E! F
   push    eax, A. F, r! H7 Q$ Q. {) Y% a+ v
   call    KERNEL32!_lopen# o+ _0 j1 q( _: {& ]
   inc     eax" P. @( Z5 _* v5 U- K) k& _
   jz      006505ae                  ; not detected
* {; l# h* c$ k: q3 e
. I; N5 f* r% ^* O# t& y& a) x+ s  w( d) P7 y% w
__________________________________________________________________________' P6 B7 N" K, w
+ a2 U) X" s6 y/ X4 E, G% h
Method 12% z/ g, P1 B$ Y- q$ {% p
=========/ u3 Z  |* P1 R
: c) v2 q: D$ a" _
This trick is similar to int41h/4fh Debugger installation check (code 05
1 e& H; J9 r" n" W&amp; 06) but very limited because it's only available for Win95/98 (not NT)* m" }2 a% m1 q% Y& V& x- q
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.. ?9 U/ u# E& l! v1 A: U  I( G

/ Q! f* Q9 B$ h* u3 H1 l   push  0000004fh         ; function 4fh
# Q8 X- ^  Y9 r4 s3 n- t( B, w   push  002a002ah         ; high word specifies which VxD (VWIN32)- n, a' g5 c6 W# }$ [. a
                           ; low word specifies which service
) j. j5 C* Z: M! s7 F                             (VWIN32_Int41Dispatch)
: M9 l& |3 y. X/ r' Y! G$ K/ I- k   call  Kernel32!ORD_001  ; VxdCall
! N/ S2 k: J0 h9 [% G   cmp   ax, 0f386h        ; magic number returned by system debuggers
# Z: c& K5 ?# h+ V3 C3 D& y   jz    SoftICE_detected- F+ F- v7 ]" E) V" x5 X1 l

% N, ]4 \, J+ rHere again, several ways to detect it:+ k6 ]9 ]) H  B8 z

- `2 [7 ^' k' t8 b# s    BPINT 41 if ax==4f
" N& H/ G; b$ b  c, z# b- b+ r
# y/ ^1 a' W  \+ X$ e& Y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one* m! I8 l0 g  \$ f7 L9 M' }

+ c3 E9 F$ G' r# j    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A) f+ ]* Q% n; Z& d
6 K/ r2 n  u+ Y6 g7 O( p- m+ N; S6 a
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
* J  V1 D. O7 H, M
  w( u1 \; o4 m4 {0 v, C* p__________________________________________________________________________/ S8 d: B3 l4 y# R5 j
1 E$ F% o: h# g! l8 h
Method 13
/ N6 D! a: c+ V$ R) G=========& E3 r; M) h+ V8 Z

. E6 b: f/ \' Z& A$ ^* A2 fNot a real method of detection, but a good way to know if SoftICE is0 ]( Z9 |) ]7 d& O
installed on a computer and to locate its installation directory.+ l; R8 b2 C+ q) f
It is used by few softs which access the following registry keys (usually #2) :* m: Q4 f& m) S& z8 x4 G) G2 Q# _
0 v6 a* Y: V: C, _/ }% d: y# m
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 Y6 a4 A9 q# ^% U3 B5 N
\Uninstall\SoftICE
4 g: U; y6 K2 W* r: ?0 i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' g7 L% ~' f3 X, {  [* ~9 ^-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ X# n6 b/ l, ]! A8 \+ Y* N
\App Paths\Loader32.Exe
4 u% H: B9 |2 ]4 |0 O( [& i8 {  Y9 q3 ]4 Y, N7 m
6 I7 R( \* m/ K0 G0 {7 F/ _, M
Note that some nasty apps could then erase all files from SoftICE directory
4 ^" H+ S, T3 P7 D; Z$ T(I faced that once :-(* _2 c$ H! I2 G! w# {

; J4 m- N- f% c. {) D1 R4 aUseful breakpoint to detect it:+ e/ \3 Q; S) K, V' V" W

( s7 I' p2 z  F+ M     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. H# c- T" t0 k  a/ v* }

. y% S6 y% B8 z6 ?: g* f+ B! |5 k- H0 q__________________________________________________________________________
' t& f2 `( A, w+ z
& F7 u  B. L  `  \. r$ d1 }/ W# v2 w
Method 14 8 ~- h; l/ T8 J- G6 q3 T% P2 a
=========0 s5 P" [+ t, o* E0 P$ B, g
% q4 E6 h, H4 h3 a3 ?$ ]
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 s3 t; ?- B% K8 e4 d9 vis to determines whether a debugger is running on your system (ring0 only).
7 u0 O' v& Z6 o9 F* C9 v
. a. q( r# k# P" g   VMMCall Test_Debug_Installed! r4 K# `: r7 Q8 |
   je      not_installed, [0 Z( s" Z+ U& r! H4 U

8 V2 I- H3 E1 V5 f5 t7 zThis service just checks a flag.
! W0 Q+ J+ X2 K7 d</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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