找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>' H! i' b4 _' k
<TBODY>5 m, a" l# }$ [' h
<TR>) V& z8 O$ F$ A8 e* [: j, c7 V! J
<TD><PRE>Method 01
' P2 k) e/ A3 m6 _5 d: K=========3 E% i  i6 b. ?
5 a1 t1 w( n. {
This method of detection of SoftICE (as well as the following one) is
- P  G; U5 N) O! pused by the majority of packers/encryptors found on Internet.+ C) ?6 k0 j  k- C
It seeks the signature of BoundsChecker in SoftICE
" K6 v" K: f) V* M. }$ U5 U7 r- }) x  ^1 t6 {2 r& l9 W- c
    mov     ebp, 04243484Bh        ; 'BCHK'
1 N6 h# V& o" }4 s6 Q+ ]1 \! L    mov     ax, 04h
2 V" j' f1 n( U& E    int     3       ( e+ R; E& S' _6 h1 S; w
    cmp     al,42 R: q9 d$ L' f' O+ [2 L
    jnz     SoftICE_Detected
, n- I' M, g8 A+ Z6 S  R+ ?! U8 O1 \3 ^
___________________________________________________________________________( u( x' \7 i; r: h1 p0 [1 t

6 R7 P" p& w* ]$ z7 W6 UMethod 021 k4 X) K7 c! K+ {( Z- J3 C
=========
+ _( e7 d& E& P, ]3 \# n: l* z0 J
Still a method very much used (perhaps the most frequent one).  It is used
. M9 |4 _* [" q% a4 ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; E0 p& o0 i$ X9 d9 }or execute SoftICE commands...) g$ D- Q+ v+ n/ |" ^0 j5 Q
It is also used to crash SoftICE and to force it to execute any commands
" U% b1 y" }# S% b(HBOOT...) :-((  + B# U$ ~% o/ g% t8 p+ w

  o( {" u/ h$ y. P8 H* yHere is a quick description:
/ b" R& \+ |9 ?$ x* {/ V$ M$ `1 f/ N$ s-AX = 0910h   (Display string in SIce windows)
% h) }: K8 Z/ a. I& @-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); J2 O" w6 }8 \$ u
-AX = 0912h   (Get breakpoint infos)7 T# b. P. A- J' U& }9 F
-AX = 0913h   (Set Sice breakpoints)# a7 Z# p" J* l
-AX = 0914h   (Remove SIce breakoints)
; N; G  e% |6 V) d
8 B6 A4 {7 z8 m9 Q1 REach time you'll meet this trick, you'll see:3 D+ _% J6 U' R( R0 v6 ?
-SI = 4647h
4 x& Q6 G8 F5 @! V7 O3 W- G  J-DI = 4A4Dh$ X0 `& p( S) x- o
Which are the 'magic values' used by SoftIce.
5 V' n9 x9 L( S- d+ ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 m' d7 d8 O3 X8 M( `

) Z" S% Q  P  X/ S2 S1 G7 ]Here is one example from the file "Haspinst.exe" which is the dongle HASP
8 E, H$ p# p# M" d! I" J2 D+ mEnvelope utility use to protect DOS applications:
0 `3 l. A8 h$ M, p+ E( K3 H4 E7 H4 \2 _5 b2 \0 S+ x8 k
8 m3 f; ~3 G6 |
4C19:0095   MOV    AX,0911  ; execute command.
( p) ^! W9 t$ I+ C9 g2 h4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% P5 n3 m  w! e1 F. O6 L# ~: n+ ?
4C19:009A   MOV    SI,4647  ; 1st magic value." ?( p% g9 ^4 c: y( ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
8 A& [' _6 h2 t4 l! e& x( g4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 C* f' T. w. J6 ]/ u( [7 q
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute8 w, h" W# j6 c& h
4C19:00A4   INC    CX/ a; a% @) o0 q5 f" l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
. ]. _1 J/ n1 V) y4C19:00A8   JB     0095     ; 6 different commands.) ?( `) n1 ^5 A- ]5 d3 C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
! E0 k9 R7 z0 c6 o  a) Q  v, k4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
- }  k& J6 ]* x+ ~- b: i5 E6 D9 H1 C' C; E, z0 }- p
The program will execute 6 different SIce commands located at ds:dx, which0 {( }, ^( P8 @9 G! t& n5 m
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 b! K- Y4 ]% q% @& D$ K6 V; ~& Q3 l. n- o% i! h
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 o- l0 ?8 K% U___________________________________________________________________________
1 o: J: L' c- L; K$ i% F$ S, u3 z- Z: x) e( P8 A# L. ^

1 h, |1 [" W3 y8 U" F. EMethod 03
5 P0 z# t& Q5 s: E' e. C2 O! d=========8 W- z- T' I. i" Q
0 I  J, _. e$ B0 }+ P
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: a, |! b/ S+ q- `/ M! m6 @
(API Get entry point)
+ u7 e0 S5 n4 q2 [0 r  ^        ) e1 r+ v- Z+ G/ D! U

0 t! r5 C3 Y# N5 B$ i    xor     di,di
2 J: `. R0 M: g; Y& ^    mov     es,di# \+ N# v* W- P  [+ C8 _
    mov     ax, 1684h      
/ u" }# n2 O1 d' B- G8 }    mov     bx, 0202h       ; VxD ID of winice
# m8 _4 E4 e% E2 c9 ^  G    int     2Fh/ y- X$ k" K" x6 q
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 t5 K/ I( y4 c    add     ax, di
- c( A5 _+ |* U0 [* t    test    ax,ax5 a) d' d& [. G0 x, m% S' q
    jnz     SoftICE_Detected
. i# x" |! s! P
1 \; f9 J" X2 c8 b% ^___________________________________________________________________________; E0 ~9 f& A6 F- [, h: Y5 K
) u- H4 R1 Q2 B
Method 045 {% |5 U+ E* _: c, I1 H
=========
2 z" g" ?/ Y2 B, E$ Q- M" M: \. U9 R' e0 f
Method identical to the preceding one except that it seeks the ID of SoftICE8 ^: B# w3 n& D2 W2 H  N1 U
GFX VxD.# w1 o& N' \; F2 P: [) [& [0 \

9 D* J8 J: u) Z    xor     di,di; J/ }1 K5 j/ U" G- `- B" k  j* x1 s
    mov     es,di# a. o/ H: _  l7 B+ t
    mov     ax, 1684h      
( ~& I4 F" r- J5 M/ Y  S    mov     bx, 7a5Fh       ; VxD ID of SIWVID" l4 [0 U% z& {8 w# a8 R7 h5 f
    int     2fh
& K; x0 T) S* s+ }    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ ?' \+ t# b' \* B; e" ~
    add     ax, di
% F4 V3 }. T% G7 R( L" X    test    ax,ax- n4 B3 W+ [2 G) N0 b
    jnz     SoftICE_Detected
2 L/ x' C; S. U4 ~: D( p
+ u6 R3 M2 e9 q9 o3 k. v0 M- {: A$ O__________________________________________________________________________/ b' C7 Z" m8 z; ]# d5 j

" X; ]( k0 s, N9 J8 h: p, z" h2 X
* O2 u# k9 u8 L; ]% H" R: h4 @# `Method 05
4 K) n& C3 j, X0 u=========
% k. r' l& q7 L5 }3 J' H2 X: o
3 L; H! R0 c: A: v- f! b; jMethod seeking the 'magic number' 0F386h returned (in ax) by all system5 v3 R, Y4 [3 U& f
debugger. It calls the int 41h, function 4Fh.
8 W  j) T9 k  Z# |, g2 {There are several alternatives.  + C, C7 E9 ?/ Z0 S7 ^& T9 w$ g
; `8 G# o! e8 x7 O4 i
The following one is the simplest:) J1 f0 }5 a* W% S
0 u$ [6 U& h2 E/ j0 T
    mov     ax,4fh
, I; P9 f6 q# }2 c9 k    int     41h
7 ^  u3 v4 z: E& p& a# b    cmp     ax, 0F3864 Q9 |. D! i) Y  g; f
    jz      SoftICE_detected
6 c% a- z; y1 b" G4 |  T9 l
( X3 p) ?  _$ h1 K
' r+ \! Y8 n4 CNext method as well as the following one are 2 examples from Stone's * X  G8 W# W' }* }( _
"stn-wid.zip" (www.cracking.net):4 {$ t( `: z* t- F9 p1 a/ g8 k( Q4 R
. e! @3 W+ a8 H5 a7 j
    mov     bx, cs
  P+ p9 ?  i6 D- q    lea     dx, int41handler2/ ]2 l  a/ ~8 o0 S! q
    xchg    dx, es:[41h*4]. ~& r- a7 D- C1 d% \  D) |
    xchg    bx, es:[41h*4+2]
4 Z/ R$ V/ k# U    mov     ax,4fh. p; ~& o$ p2 @% l2 M5 I
    int     41h
4 X+ s; K; S- }3 E9 F5 J* X    xchg    dx, es:[41h*4]- V: w& o2 ~* U. Q5 {
    xchg    bx, es:[41h*4+2]1 z: x1 ~5 {) G$ b% v; L
    cmp     ax, 0f386h
+ [; n2 F% M, s* u/ u    jz      SoftICE_detected8 L4 n" V% M4 N6 {# G

* e  }4 ~6 c( {+ dint41handler2 PROC
$ c6 o( ?( m$ S0 Y% N& S    iret2 p" x5 |: `+ Y
int41handler2 ENDP' T, @9 {, Z! v: A
  a2 ]4 ?2 ^- ~$ C- L! f

( Z( x' A0 E& ~' }# M_________________________________________________________________________
6 [9 ^6 O% R  G" M3 k" {. r+ Q; w: z& e" u$ k7 P; p! s% E  x
& K" `9 p6 \) ^1 [2 l
Method 06) f" A8 H, i$ G  K' b9 h
=========0 i  E2 l% q4 H1 U) a/ D

8 k! D0 X) L; Y# A" O9 k2 M
  O. W9 B7 x$ v  X/ {5 N, i# i) I2nd method similar to the preceding one but more difficult to detect:( _1 g3 W, N! |1 R6 B$ t6 D
) F; g0 r8 a. M4 M$ M" i( _

& q; V, g% |  r5 q  J/ k1 Pint41handler PROC+ Y0 T' Z7 o! a: H! Y3 k
    mov     cl,al
" S. C$ y8 s/ l    iret
" O# D( l1 H6 Q8 Uint41handler ENDP
/ ^: `1 l) k& D+ y  h% p$ f9 w$ s+ u. g3 G7 |5 i/ {4 g

: k4 L' ]4 {! y    xor     ax,ax5 ~$ w$ ]: L, `# r1 P& T5 I9 s* O% }
    mov     es,ax
8 H1 z. l1 h4 ]2 m- L8 T$ k    mov     bx, cs- k/ F7 h# Q& {3 n. O
    lea     dx, int41handler
! B  g9 @! m: G2 n: v6 t# ~9 U) L    xchg    dx, es:[41h*4]! q; @! I6 ~' H
    xchg    bx, es:[41h*4+2]$ g% ?3 X4 J. _3 A$ `
    in      al, 40h
- m6 G9 @* k% v9 c5 S    xor     cx,cx2 d2 L4 p% n6 a
    int     41h
3 c5 v% |( }0 |; _2 G- @% W* v9 A    xchg    dx, es:[41h*4]
. {0 L+ _. _9 {/ ^. H4 z    xchg    bx, es:[41h*4+2]
9 f; F1 i9 B+ D    cmp     cl,al3 S; x" l. k% x% X7 V% f; k- h
    jnz     SoftICE_detected# ^& `% D) ?! |  t5 k! v0 L, p

" z% X* J. u9 V1 k- i" j* Y9 z* S3 \_________________________________________________________________________1 E4 d! J' f# G6 M  D! c+ ~
4 u! ^$ G! W9 \; Y3 U% d) [
Method 079 B  y; ?% P: w$ q
=========
( {' r- @+ g/ j$ C0 p: s' E0 y
! B/ U% m% @" a& [2 f/ oMethod of detection of the WinICE handler in the int68h (V86)
" A; }/ K  t8 h- G
2 o& y% g5 l: |- y0 T    mov     ah,43h0 z9 r& e6 A5 E) w0 r4 P& x' f- G
    int     68h
3 I' F+ s& |! n    cmp     ax,0F386h, ?3 E, K9 P4 l4 W
    jz      SoftICE_Detected
. h3 U5 Y9 b' N: H2 @  M; v/ U' f7 t( k

: S, U* p+ B9 K- C0 O% o=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& R. g  x6 o1 g4 @/ [9 a4 e3 |% i6 S$ ~   app like this:
* i5 S5 h+ ?( R+ z$ X& ?7 U2 N1 X/ k3 q
   BPX exec_int if ax==680 A+ X4 U  L6 N+ @2 Y
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 h0 h0 L1 A/ A0 y: X0 _  G
   located at [ebp+48h] for 32Bit apps)
/ o. e; d( Q3 x  h: G__________________________________________________________________________- v8 o; y1 {% y  K& ~; @4 {

8 V. M3 I  ]& l7 s6 X
% t! m0 W6 z5 C/ vMethod 08
9 x. C! q& J. O  H; a9 y! i=========  k; y' l; k1 E# B1 y

; r8 q/ [+ V: ]; g# v& T2 [( iIt is not a method of detection of SoftICE but a possibility to crash the2 [5 O3 x  X1 j6 |3 N/ |
system by intercepting int 01h and int 03h and redirecting them to another
- E3 R* ?% g. i3 r: uroutine.7 s1 {7 p7 U" ?) p& Z/ F+ G
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ f: q; d4 e' \1 A& N) U3 wto the new routine to execute (hangs computer...)" I6 S: J! N/ t
. r  v7 z1 x. j0 O) P
    mov     ah, 25h3 Y0 e; E, v9 @. O8 C
    mov     al, Int_Number (01h or 03h)
$ l* D" ^2 Q- F  t' B$ d# C/ Y    mov     dx, offset New_Int_Routine" t" S* L- N( a4 I+ Y2 B6 p5 H
    int     21h
' B, W# q( w) j: h  i' P$ P# Y" a1 d' x/ w: H; R2 G" {
__________________________________________________________________________
; D) a) Y  T8 i# g: Z. G7 g
  [5 e* j/ V! A- ?2 k& g  ZMethod 09
; m4 L1 T) P$ y' r0 ^+ [) u# a=========
/ K, d; _) B; [& p$ O. v
2 T+ z* s/ J) ?This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( p/ @4 S1 U; D# y9 U% u
performed in ring0 (VxD or a ring3 app using the VxdCall).
, M/ Y' z* y2 v, l; s; mThe Get_DDB service is used to determine whether or not a VxD is installed
. r$ ^. f9 |# k4 q7 {" Gfor the specified device and returns a Device Description Block (in ecx) for4 E; m# X# \2 s6 ?
that device if it is installed.! U: A& K+ D4 a9 w5 a/ I
/ J8 X6 ~, h8 f2 Y" w; g
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: B% T/ ~9 J1 q$ w& p) p8 _   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
: e9 [! J; O) z" }( A# L  z   VMMCall Get_DDB
" U7 a  T: w6 }- n5 _8 \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# B$ Z$ [# d- _6 a% s9 s

) H. d/ L: s0 |Note as well that you can easily detect this method with SoftICE:
! [6 M0 q: b+ i( a$ n( a* I   bpx Get_DDB if ax==0202 || ax==7a5fh
) O1 O( [7 n' e4 ^* f0 b1 i* r
8 v5 |1 V. g* W' F9 U, @: |  V__________________________________________________________________________; G( m' ^- p2 `% [8 H) Z. \1 v4 l' K, d

( ]- W$ {& B$ }& b+ g% R4 ~Method 10# m' Y6 x$ p5 P. \
=========5 ]( v3 `$ O, T3 d+ s0 C
) A* q+ F8 E8 X, A! a; r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ @/ i- n# W5 d# z- ?# S4 d  SoftICE while the option is enable!!
% f# A. D/ S0 f6 S. S7 y" ~
  O( v9 F" Z( H: k3 uThis trick is very efficient:5 Z: a. M; C  {% d
by checking the Debug Registers, you can detect if SoftICE is loaded
) `; s  g  X3 t# K(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if6 b9 s* Q9 ~9 `4 {  J# X: O
there are some memory breakpoints set (dr0 to dr3) simply by reading their
# p/ j. Y6 ^7 @4 nvalue (in ring0 only). Values can be manipulated and or changed as well8 x9 j. Q2 C  q' b
(clearing BPMs for instance)  ^; }5 j9 L7 C3 e7 H

% s9 O. Z, Y5 W& l5 O__________________________________________________________________________
# q9 G# C0 Q& P
3 v$ V6 L+ b. }+ d! s3 oMethod 11
( c7 |1 @  w, j+ P# x7 u=========
' @1 V( l7 U7 W. M  z8 E0 X8 Z
* `# f# \( H+ h, D) I; n+ [8 UThis method is most known as 'MeltICE' because it has been freely distributed
% S" y+ r7 p% f! T3 [9 A: W% \" Pvia www.winfiles.com. However it was first used by NuMega people to allow7 Z- G7 i( e+ a; O! v% h: _
Symbol Loader to check if SoftICE was active or not (the code is located: u" k! c4 L6 V( S
inside nmtrans.dll).; M6 y  X' \! _$ u7 p
5 k0 D! K9 a' f- ~8 k4 j6 S
The way it works is very simple:
) H7 ~1 F- m# S8 p/ P( x! hIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
+ i- L0 j! O* Q0 y1 V! Z! HWinNT) with the CreateFileA API.
7 I$ r9 a9 }2 T7 a: \$ K. r! _% Y" c, z4 G6 H% p+ L( J8 r
Here is a sample (checking for 'SICE'):( R% s* b, g8 l9 z7 {
* i$ Y8 Q5 T9 c$ \7 Z0 |: b( y  q
BOOL IsSoftIce95Loaded()5 C, Y0 c& N$ e: j" j' y
{' S. ?+ ?. O6 x. h) ^1 l+ `
   HANDLE hFile;  $ U0 H! G& p" W/ H6 q
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 }/ Q; X/ O- K$ }/ F0 b
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! z. K0 s7 u1 H! M) s. ?                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 L7 E5 N4 [* Q+ Z, j   if( hFile != INVALID_HANDLE_VALUE )
: t  u0 _* J# s, {2 ^2 W. t   {
( r8 L. W0 Z1 g& s7 A2 Q      CloseHandle(hFile);  W# }  s  X% Y5 e
      return TRUE;0 o9 A/ j8 e" t- S- E
   }  g) y9 R% U' W  ]- n6 X! b
   return FALSE;' ]5 x4 V4 e3 V& J9 n9 y
}/ q* R/ o+ h8 T2 I9 a2 a1 N5 e: {
+ }5 f* ~1 y; H
Although this trick calls the CreateFileA function, don't even expect to be
: a/ ]3 G% @3 t+ m6 U9 nable to intercept it by installing a IFS hook: it will not work, no way!
# _" _7 h& F6 v! iIn fact, after the call to CreateFileA it will get through VWIN32 0x001F" K2 s8 d+ Y+ j5 v2 V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
- m6 q* [* t8 e3 n4 t* Aand then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 o7 h& B2 @6 {' y7 ufield.1 }! w% _: F2 y% Q, C
In fact, its purpose is not to load/unload VxDs but only to send a
, J$ G8 o! \- A5 k$ cW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)- `3 x% A5 @! Q8 Z) S7 T) B
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ O7 t% a0 ?' I5 V$ bto load/unload a non-dynamically loadable driver such as SoftICE ;-).- g/ Q5 o- b! j- ?
If the VxD is loaded, it will always clear eax and the Carry flag to allow' u" @+ N4 z7 {3 V% Z
its handle to be opened and then, will be detected.
: x+ _3 i9 g  u$ s! z3 XYou can check that simply by hooking Winice.exe control proc entry point
4 d% p; |1 G/ _; `- C) M7 pwhile running MeltICE.
0 D- v% {: ]! V8 d
- J2 e; z) E8 r7 E" t) ]& }6 \$ f7 J3 B0 e
  00401067:  push      00402025    ; \\.\SICE# r6 R! w  u$ P, z) @, I+ y' {
  0040106C:  call      CreateFileA$ m& `' v! U; `: K
  00401071:  cmp       eax,-001
2 ^7 O* W6 @  S8 H  00401074:  je        00401091
; F' B, u5 Y9 m3 }- r1 p6 g2 z2 k1 t& Y# K
/ d7 U2 X3 e/ I' _7 ]! r7 t! A
There could be hundreds of BPX you could use to detect this trick.* F; b' ]/ e7 N" b
-The most classical one is:
" p5 r+ y" c  M9 `/ }* z/ W  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
2 _* S: B$ x) Q3 V! j* D( V4 Y    *(esp-&gt;4+4)=='NTIC'
8 b% a- s& q, M# _' ~# Q
0 k+ y) ~/ L+ L+ z3 ]-The most exotic ones (could be very slooooow :-(/ T7 p7 o, g9 G+ g8 @0 b% G% l7 n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  , |; N3 E' M9 r* b( T, |$ R
     ;will break 3 times :-() N1 [& D* {9 D% z5 ?4 L& k# ^
5 d# C" b( G+ p- b) I+ g- \5 j
-or (a bit) faster: 8 A' B- c" x  e
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  V6 z* s- y. W$ Q+ K

1 U. B' u, p5 Z: [) f% A( b   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
+ F; A. p9 T3 N; c     ;will break 3 times :-(  A; p" C" v  j3 S

3 ], ^# g/ H; F" _-Much faster:5 W7 s1 U( T8 R9 M5 k' B3 ^( k
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') D9 }7 Q3 @" Y" S3 B7 z

5 i  k: }3 L% q# h1 W3 @Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
# R( r! L9 e& r' z" X' R, Cfunction to do the same job:
3 A6 B" B" F( F
6 p2 Z" X  c. I( h% M3 K% y3 E   push    00                        ; OF_READ; X4 [. O+ \9 T) ]5 \* I5 v
   mov     eax,[00656634]            ; '\\.\SICE',0
: d4 D# }: c7 X4 ]   push    eax5 \6 ]1 y4 @0 y
   call    KERNEL32!_lopen% W( l9 ^: g5 M% Q
   inc     eax
  H* d% ^& V* \- n+ ~2 n1 X+ C   jnz     00650589                  ; detected
2 Y! s/ M" D  |* }6 ^0 H  H   push    00                        ; OF_READ
. ^! S# r% O/ U3 N! O   mov     eax,[00656638]            ; '\\.\SICE'
) N( \* S, H' L   push    eax( I6 Q5 p. F7 Y2 a
   call    KERNEL32!_lopen
" D: p) {* E7 d, x$ N   inc     eax
' q+ j) V* e/ x* L( E   jz      006505ae                  ; not detected& a6 C' }2 j# L* ]3 |* Q
7 k2 e. i  e) v/ {+ L" z7 U0 h5 ?

: c4 [* p! Y8 u4 \9 Q. G7 V__________________________________________________________________________
+ x% o4 {0 Z' ~' W) [" G6 i9 Z0 {. [' x9 G4 _! A5 t
Method 12
; H; e& Y, a2 j8 c) P9 n=========
  y, t: b8 x8 m6 u5 ~& z3 A
, U  s+ O4 n/ y. |8 g% iThis trick is similar to int41h/4fh Debugger installation check (code 05
% z0 V7 w+ m) C# K% A8 F& S- l$ u&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. }  s3 e' G% A+ \as it uses the VxDCall backdoor. This detection was found in Bleem Demo., S. I' z' N7 \/ ^

7 F$ X+ [" m+ w: \$ g   push  0000004fh         ; function 4fh' e; l$ r' m+ |
   push  002a002ah         ; high word specifies which VxD (VWIN32)
* b! Q! L- j: P4 S) B+ i                           ; low word specifies which service
9 g+ w: f% }- X4 R7 H                             (VWIN32_Int41Dispatch)3 _* V# `* n: s/ T+ R. A
   call  Kernel32!ORD_001  ; VxdCall; T( J; r3 @6 {
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, ~5 t) A  N' U: t+ z  b$ }   jz    SoftICE_detected$ t" J+ s0 Y; b  [0 ]& V
2 M) y1 Y  C6 @" M8 `3 F7 D! G5 p, w- w
Here again, several ways to detect it:: A7 ~. ?6 ]! ?6 g& R' c& t
& _3 p9 r( B1 @4 u$ b7 H
    BPINT 41 if ax==4f
3 G( d9 R9 X+ @/ L
( k9 g  `6 Y9 b7 J' E3 e    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
# \7 ]6 N5 @: O% D: @& @- D3 I. s; Z7 D
8 l5 p8 n% Y! t6 h3 [8 j5 O    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A1 N, l, t5 h. B0 W) ]! V9 ]
4 k, `: Y% k  D7 q1 ]) P
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- T0 S8 Z3 M; t) ^: c6 q% }) ?" c9 t1 V* @$ B8 W
__________________________________________________________________________
0 K) ~" Q) B4 h$ |- u% V" j* P5 g+ X
Method 13& O: ]. j/ ?* h" o( S7 g
=========
6 i+ W) L# Z2 m4 d4 t( C" S
; w/ m: A' U( r  w- I' f' eNot a real method of detection, but a good way to know if SoftICE is/ V; d9 J" ?9 Y
installed on a computer and to locate its installation directory.; m+ R: h* ^; U
It is used by few softs which access the following registry keys (usually #2) :7 p' ^, c6 v- j) v' @9 g; x) n

& y1 c- w  N# m1 H2 C( L# ^, X, b: N-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
6 l* x0 ?, U7 {\Uninstall\SoftICE5 w6 O% X5 B6 |- |
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 p0 ?$ q4 }; ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 R8 K7 I( y" B+ e% c9 I9 C  @\App Paths\Loader32.Exe
; O7 E6 N( f) R: i0 k# w1 }' }+ A1 E! J+ U! f6 n
8 X: ?/ ^" \/ @$ A# G
Note that some nasty apps could then erase all files from SoftICE directory7 `% ?6 H) O; e7 E$ A
(I faced that once :-(
3 L# I6 N8 ?3 s% Y# {6 c$ i( `* Z, G
Useful breakpoint to detect it:; Q& N+ P+ }7 E0 s3 h# [) m' q
- j' R( ^5 W# M7 i
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 i- m3 X/ U$ A' f/ M( A7 D; d
( B5 O3 U5 J+ L( ?
__________________________________________________________________________
& F) b8 ^4 T' Q) F0 x" `
7 i* W9 r9 G: B  Q- I) R- {' \
2 d% T* F. J2 h0 aMethod 14 1 D9 A) G  }/ H
=========
8 m! d0 X7 [: s4 L2 y: ?  j$ B& V% Y7 T( L
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 O- D7 p) t; S9 e/ u" E0 ^
is to determines whether a debugger is running on your system (ring0 only).* ~' @  t' S- k

$ W5 U8 B: i% D   VMMCall Test_Debug_Installed  Y$ ]* I; p! n* ?* |( N
   je      not_installed3 Z3 _) v7 i0 x8 r3 o1 ?/ e
( M( I( O. Y& R0 S3 j, ?
This service just checks a flag.2 b/ `- T' ?2 n! ^: l& Z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-20 19:26

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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