About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* @) m, t* J6 a4 N/ ]3 c% m/ w8 s% G, o
<TBODY>/ s( M6 l8 _# ]6 t" C" E, e% G2 W
<TR>
4 V: V7 S) J5 |& I! d<TD><PRE>Method 01
: @+ p: A( y0 x6 G=========
6 i/ _0 z9 e% B! ^* F8 o' Y
4 _1 [. \+ A; F- C( D9 YThis method of detection of SoftICE (as well as the following one) is, J+ T8 b  Y; v; y. H1 [, T
used by the majority of packers/encryptors found on Internet.8 W: l% U3 m! k
It seeks the signature of BoundsChecker in SoftICE) e, V" ?" Y  C' J) I- U4 r6 X
- N! V; z+ {6 Z! ]
    mov     ebp, 04243484Bh        ; 'BCHK'
/ M* ]0 Z! G% f0 S2 N( ]% L1 D    mov     ax, 04h
6 T' X5 P5 O4 I2 ?- ~    int     3       / |( P& P9 _1 h: b
    cmp     al,42 I9 I$ |3 C% H& }1 {1 }% ~
    jnz     SoftICE_Detected
: Z( M# u5 w) G8 T" `# p! H6 ?* b, h7 u- C/ {& G
___________________________________________________________________________
8 V; C% b0 |8 [5 I3 {, e
8 E; s, C; R! YMethod 02
* o: z& a) f# J1 Y$ R3 y( ~=========/ ]& s9 q- _, a9 h" {5 W, V
! }, r+ N* d) |* O5 J& _: \
Still a method very much used (perhaps the most frequent one).  It is used! h: Y7 z0 P4 G7 Q0 t1 ]2 j3 j
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,  f. \" ?9 W8 L9 k; i
or execute SoftICE commands...
& V  U$ `0 H: z/ V. C$ f( m7 PIt is also used to crash SoftICE and to force it to execute any commands( \" Q  p0 j9 z4 v+ d/ M  w
(HBOOT...) :-((  2 j. H' l9 V* B# i" J1 w7 m' t' n
: M/ J. x& I  X5 L" G
Here is a quick description:8 b. b* o7 U) D$ [- t3 Q
-AX = 0910h   (Display string in SIce windows)# m' p7 i* y  \: L: a; ^; ?
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) c0 C' |" c2 @, w9 Z8 `% `-AX = 0912h   (Get breakpoint infos)
- y/ U# x# r( A  A* }; Z" R-AX = 0913h   (Set Sice breakpoints)
: X: c1 n3 g# q+ I" L% Z1 Q-AX = 0914h   (Remove SIce breakoints)
: a3 \8 i; o; z1 P* b  [6 |- V
6 G% {7 |5 s% T: Y$ s) sEach time you'll meet this trick, you'll see:1 i- _" u# b  Q& q( n
-SI = 4647h
5 P5 v/ h; u1 o6 ~4 b. ^* ~) q; q6 t-DI = 4A4Dh; L$ W) K$ k! s+ X) D5 o
Which are the 'magic values' used by SoftIce.# i3 ~3 _9 m4 y5 t( R3 x
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; z) [- G: r0 I
* @5 x+ T& v0 T9 r
Here is one example from the file "Haspinst.exe" which is the dongle HASP! o) j$ M# O2 Y# X/ L
Envelope utility use to protect DOS applications:& K# v1 L8 f7 c/ d3 w; r' |. e
6 x' R$ |4 m5 R& |" F& [
. t, m! X" \) N7 ^- c) c) C  f
4C19:0095   MOV    AX,0911  ; execute command.3 O, Y* W5 G5 f. m; k
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 G+ u( n9 X5 m, z# w
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 y. B7 h2 Z! V4C19:009D   MOV    DI,4A4D  ; 2nd magic value." k, I4 D% O' U; S5 a9 ?8 Z
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)5 a; n3 c# K) I( m  R, K$ z9 F. j
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute( I1 I3 j' @3 Z, d9 ~' w
4C19:00A4   INC    CX+ x" ]+ f6 Z( t: a5 M
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 a' D6 e  y1 W4 k; B* q4C19:00A8   JB     0095     ; 6 different commands.
% O5 F7 [1 l, a! w1 ~" M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% @, j" v( h& I# r, t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
2 |) n: n: a# P, S- F4 B+ ~! b1 z) j6 T7 k$ o
The program will execute 6 different SIce commands located at ds:dx, which& }# j8 B; N: h8 K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- e. r0 x1 Z7 x/ ~: ?$ x7 {/ f
5 W+ ^$ O. _. v( i5 w( g% }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 u0 N% ^3 Q: O6 x6 \: u, r
___________________________________________________________________________
/ ^; u) D* x) l0 h0 I* @) S3 X* D
7 V7 g: q! |  w' ?3 A) M8 E9 g  C# A; t/ p0 ?0 o5 B# P
Method 03
$ `) p/ o- t( s  m=========
! A3 ^  T8 [& a2 O' H3 _) b3 o/ o% c) r) b
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
  [7 z9 S" ?% x1 _(API Get entry point)9 n! U" Q$ ^8 v( r& u
        3 o5 n, e# [+ e6 W( _0 s
6 {' A# E# Q6 R2 ]
    xor     di,di
( \0 P: j* `2 k    mov     es,di' M1 w: d3 P; z+ Z9 ]4 K* d
    mov     ax, 1684h       . _- d) `+ U( ?8 ^! d
    mov     bx, 0202h       ; VxD ID of winice) \( G6 }8 U: O: @
    int     2Fh
5 Q6 ?  \# B1 D) j    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 F  ], p5 y# z1 Y
    add     ax, di
5 I5 k' P& F1 X7 ^1 z, @    test    ax,ax
' F: |( r+ u* S8 j9 o+ v5 z    jnz     SoftICE_Detected
' a5 c7 \! s0 T. F" Q+ n& \& d) E
" A9 V* P; W. C___________________________________________________________________________/ R6 ^' V) R0 @1 O
8 s( v9 g# ]$ ^# J
Method 04
& Q1 g7 U' b4 @9 y& s" s9 u=========
; K6 L4 m& O1 f9 V) k# P' z1 ]6 d! l5 \9 G& B2 e, @
Method identical to the preceding one except that it seeks the ID of SoftICE
' y- X4 o$ n3 n( HGFX VxD.
5 ^4 x' \' Z; w# ^/ i: x3 m- }  I$ N+ U/ t
    xor     di,di
. u! B1 A$ i' l2 H% W: Y; B    mov     es,di
2 s6 h5 b5 l1 a- e  O    mov     ax, 1684h       $ p3 v" ]5 ^6 R# r! c& N
    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 `- J* ~- p: I3 q" e4 N0 o: x. ?* v
    int     2fh1 L7 D* I& q6 p3 O& }) e* L* C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 s( w( n8 ^% f7 d/ w. w
    add     ax, di
; F$ s( e4 `2 x- [$ d    test    ax,ax; n. K" g0 L0 E6 a
    jnz     SoftICE_Detected
4 d  c, g8 v" j3 u, H+ _
3 z2 A2 m. e* d0 C__________________________________________________________________________; `! D* X7 s, J1 |

8 m  x6 N3 W" d4 a3 z) Q0 P% x+ h. z
Method 05
  r& }- ?4 a. d3 d=========, f+ O6 x/ G; Q: i) V6 X+ X/ f
* w* U/ o) R- n4 C" F# i
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) y6 C3 S4 @2 L% i5 z7 e3 |, ?debugger. It calls the int 41h, function 4Fh.
+ x) u- i- `$ k$ A- H/ }1 yThere are several alternatives.  
3 t. [! B% B* p/ B5 X/ {0 N6 E# l; `2 T
The following one is the simplest:% {( ~9 w: p) f

! \- N. B) k' T( E( g4 R2 F$ U4 E    mov     ax,4fh9 W# L- Z5 h7 l: ^$ S
    int     41h. _) R" W3 Z1 O2 o
    cmp     ax, 0F386: T- F% L, g4 m; Q2 |# e! i; g- R
    jz      SoftICE_detected$ W; g% ~: B: R: n9 O

$ S& o% h( m; l7 d% C/ ]1 Q
4 @5 j& G& F/ S4 c6 d+ k" bNext method as well as the following one are 2 examples from Stone's , H1 h# R8 L) p$ R" n
"stn-wid.zip" (www.cracking.net):5 ~9 p: Z/ J* z* S. R# {

3 a' s+ U- [  ^    mov     bx, cs
2 R. O: h2 [/ m& V$ f( e2 e: z- Q* \    lea     dx, int41handler2* u% p) @0 n" e- [- n& q" D
    xchg    dx, es:[41h*4]
4 V) Y4 A% _7 \3 [    xchg    bx, es:[41h*4+2]6 E) L6 [: {  I: T
    mov     ax,4fh* i, M1 b6 h& X$ M& N1 K
    int     41h
) ?) x5 I% u* U+ N# \    xchg    dx, es:[41h*4]
/ X4 I4 i; J+ e8 \    xchg    bx, es:[41h*4+2]
: F  \2 r- J# ?0 i' U0 W; p$ A5 r    cmp     ax, 0f386h* `& _7 p2 j- A. G: ?; v6 f
    jz      SoftICE_detected
( `+ O' q4 v  y0 {( t9 f" n- N! E6 P, `% N! ~* `
int41handler2 PROC
3 Z: T4 m+ v( c4 d3 Y6 O    iret" W7 W4 G+ m  z6 T) d
int41handler2 ENDP/ k! V8 q9 `9 ]8 W; c% m% k

4 t& p2 y: T$ a3 H9 |
' O+ f3 F9 }' G4 C" Y+ Q" ~, ]_________________________________________________________________________
7 ]3 Z- X, I6 p; }* }1 C
4 T' E% j7 t! }, a
/ m1 l$ R8 U( b- f# h0 s% H! ]Method 066 p1 k, g$ p5 G5 f% m' [
=========- k! N; Z1 C. I. M0 t+ R8 Z

) e7 C9 J# G7 m5 u, q) W, M5 \+ l" V$ X) A% ?/ @
2nd method similar to the preceding one but more difficult to detect:
; p9 V( B4 L+ N3 v4 o0 j7 b
% ^, v/ r* d" s/ M: t4 O  `) o+ b  u
int41handler PROC
& b4 u+ i/ t4 e3 q, W    mov     cl,al8 |% t" J; s) @' z* {4 [2 k" x
    iret% W& e' O  f1 m
int41handler ENDP
! \. T* Q! O8 z) B9 |( E+ Q- f9 f) j
+ R# p7 k# }& q, L/ F0 c; |1 I+ U3 T4 f3 X4 v8 l, g; x; k3 D
    xor     ax,ax4 `" N7 t9 Q& \+ u3 o0 z
    mov     es,ax
$ H4 y' J8 ]6 j# ^2 n+ l    mov     bx, cs/ G8 O  K' m' Q+ D; z& B2 a
    lea     dx, int41handler2 H' o$ ?; g/ q$ z+ ?6 J
    xchg    dx, es:[41h*4]
% I. }6 G" C5 o/ v    xchg    bx, es:[41h*4+2]7 @7 n/ g4 B& I5 Q
    in      al, 40h9 v% g* ]8 Y) G. H* _8 |
    xor     cx,cx6 b; O( H8 V* ~$ ]9 q* M
    int     41h
& w6 T- \2 Z" [! g, N5 {    xchg    dx, es:[41h*4]* g" N. t0 Z9 `$ s# ^
    xchg    bx, es:[41h*4+2]" z# W) {+ i7 G
    cmp     cl,al
+ H+ c9 t0 \1 o) r    jnz     SoftICE_detected( C/ _; Y  H( b  b7 |- _

7 y1 R1 l3 j9 t# Z1 L5 w) I% \_________________________________________________________________________
0 h, d" g& b- k8 ~5 @# J' N0 ^
/ R8 F( F. L; U  TMethod 07
- {  Q9 j; |! N+ Z( |=========- s; w, r. p7 h7 O9 v) B
+ s; }1 h% f. ^) n; h
Method of detection of the WinICE handler in the int68h (V86)
' D* a  w# v6 V8 P6 {) Q# ?. L. j! c. v' V
    mov     ah,43h
2 K  ?  B0 e. }+ h4 X: X1 ]    int     68h% F) {! N9 j/ U/ k5 i0 a$ ~5 a
    cmp     ax,0F386h
$ k9 }' Q& q  g0 n6 ]% U2 d    jz      SoftICE_Detected
% i3 j/ i0 P- I6 B1 s( G% k
# _- N# G" B0 e+ x" q4 \0 `; V1 S6 s
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit. e0 W/ j/ _# M5 @
   app like this:
, \* Z4 _, }9 ~& W$ K8 H+ I: {# G: t
   BPX exec_int if ax==68
5 j2 ^+ D5 ]) r8 B   (function called is located at byte ptr [ebp+1Dh] and client eip is. E; y& C3 i/ l0 \: ?0 ?7 [
   located at [ebp+48h] for 32Bit apps)
# \# F  H. ~' Y% ]__________________________________________________________________________
' S" e( X# U( N, ~; ^8 j7 U" y# h9 O! e0 t
$ ]8 f/ S% n; q- L, S  ]+ j1 F
Method 086 P/ z# m+ l/ o
=========
: O% R; z0 i' f. \: C
$ u# z7 C8 e3 ^  ?  N& nIt is not a method of detection of SoftICE but a possibility to crash the
& S; e2 L# W6 p6 p. R1 T7 Asystem by intercepting int 01h and int 03h and redirecting them to another7 n: C) e( r' T7 G
routine.+ ?( I: |0 Z$ y: t# H
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ p$ s  d( y& U. ^6 H* q# yto the new routine to execute (hangs computer...)3 n7 U& q% G# ]. O/ A6 V) H% r) [
- t& h1 \# U8 e+ A- T
    mov     ah, 25h
8 i5 }# v) [8 k: n6 [  l    mov     al, Int_Number (01h or 03h)
5 ^. ^6 m) g" h1 z. v7 I    mov     dx, offset New_Int_Routine
. S$ Q+ a- a/ ^( D; A, P+ e* m    int     21h
8 p9 [- G) r* t% v$ L  R( f& i
' }; H: v, y$ y3 G% Q; y__________________________________________________________________________9 m! d3 X" Z5 D

+ t4 k8 h0 ]5 w4 CMethod 09
- ^1 \# [2 r3 ?4 u: `=========% M# p+ }4 ?1 k( [5 j
$ j. `4 ]+ a8 E
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
1 K# G$ C( V3 y! ?performed in ring0 (VxD or a ring3 app using the VxdCall).
( b, G. M5 k2 h; f7 `" w& @The Get_DDB service is used to determine whether or not a VxD is installed9 \4 j0 f! w2 z7 c( |2 o: Y8 d
for the specified device and returns a Device Description Block (in ecx) for4 ~6 u4 f- E# F/ J$ w. z# B
that device if it is installed.; \) a2 S  I; H8 j4 }
3 w* h8 j: u$ b3 G3 F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 D; @, G9 @+ q( T' O   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 Z- B3 [( x& o1 `   VMMCall Get_DDB
+ v& p' a% d4 c- `3 z& [   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 F9 g1 @& l5 b. ~
; E/ W+ w. V9 m% N, r. z7 B3 E/ {
Note as well that you can easily detect this method with SoftICE:
- p# b' r0 B, F# h4 X   bpx Get_DDB if ax==0202 || ax==7a5fh
) Q, V8 v# \; a; Q1 Z
* U* N; x7 d. K( u__________________________________________________________________________* K; z( R$ W5 S) N; @; ]3 H$ W- [; h9 T
9 Q/ v% [$ Q+ f8 L
Method 100 T0 \3 v1 r0 `! R& T8 w
=========
0 ?) j! C2 T6 U2 F* w/ j8 z; n0 q0 z' H% L; M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with0 x$ }7 |4 f# X9 V' M. `! L4 v" C
  SoftICE while the option is enable!!
" p$ ?. b( }+ _( j7 a9 w4 z5 U
: J- @; D" b' C9 `1 vThis trick is very efficient:
1 a! X( q7 f, h' N; P: mby checking the Debug Registers, you can detect if SoftICE is loaded5 |; N1 j: c1 A: I& V, L% M! {# Q
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if2 _4 G+ T; \- a, z( t3 m
there are some memory breakpoints set (dr0 to dr3) simply by reading their
+ w, t% L9 S* ~value (in ring0 only). Values can be manipulated and or changed as well
- L3 J+ g5 |# o% G; ^" v(clearing BPMs for instance)
8 Z! L( q: X/ r9 G( J7 P
" C, R/ }/ X2 K7 U6 t- ___________________________________________________________________________
( K: A9 R7 d' W) ?2 G  I! z: n6 t2 u
Method 11
# V% s+ k( Q% a" N5 S# N. i=========
, g' y, G2 V2 w3 _9 G- I6 v/ [6 a1 Q/ ^1 L
This method is most known as 'MeltICE' because it has been freely distributed
: T. F# e: u1 C6 {% Bvia www.winfiles.com. However it was first used by NuMega people to allow
/ N# J6 ^1 M5 t6 N9 |( bSymbol Loader to check if SoftICE was active or not (the code is located
& ?  h8 L2 H0 d7 i) linside nmtrans.dll).
3 G4 h5 d, [, @$ [* a- A+ p  J2 k" _2 T- e5 q0 V9 X
The way it works is very simple:/ X/ n8 |. [; n; E+ y) z( p. T2 \2 h+ F
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. Z4 p  ~$ F% w) r2 q! F" a1 CWinNT) with the CreateFileA API.& X1 s' n/ @2 G: p$ X$ X# a

. ~$ n( }+ q/ O6 n* V5 q- I& FHere is a sample (checking for 'SICE'):
' _* N/ K* W: W2 u2 B) O1 h- Y) G& T8 v& E1 N6 d
BOOL IsSoftIce95Loaded()1 l% F6 }: v0 x4 J# \
{
# ]2 R, B; S4 V   HANDLE hFile;  
, Q' y5 M9 G: b7 V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
7 N( R" p, h4 v1 A, b6 _, i                      FILE_SHARE_READ | FILE_SHARE_WRITE,
4 a% s0 @) k( w! m+ F                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);8 x. X5 z* q' w) m
   if( hFile != INVALID_HANDLE_VALUE )
& [6 E, ~9 [( f4 }. J' C+ P/ _   {& {" Z- v! W4 Y7 X) d
      CloseHandle(hFile);
; S2 c' J' u' ~) R* |      return TRUE;
4 K% Y% z4 S6 S8 H: @/ P   }& C9 ^# |; a0 n8 V' q# p8 d
   return FALSE;
$ {' J. d0 f2 ?1 D( I( e3 }}1 n( `5 k: A$ i; K
+ w/ G- H7 K5 E' H% l
Although this trick calls the CreateFileA function, don't even expect to be
" {2 `0 i7 v, ^- _; G' Sable to intercept it by installing a IFS hook: it will not work, no way!  g8 d' p+ Q* z( S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F  _9 j7 O5 M' ~6 T9 ?6 }
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
9 E7 i8 d; p$ [5 E! `2 P- ^and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 b! _. y, O8 k: v6 _' T% T) efield.3 d# h( u& u6 ^5 `5 t
In fact, its purpose is not to load/unload VxDs but only to send a
. W3 q1 j6 P& |/ R# D( g2 R# wW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 Z& r" J/ b, t  z4 Oto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ ~: k+ b9 a% h4 \# b% V
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 m- E6 G3 _# G' e7 H/ XIf the VxD is loaded, it will always clear eax and the Carry flag to allow; S/ L+ `# [  v; U; q
its handle to be opened and then, will be detected.% d+ M# b, C. o
You can check that simply by hooking Winice.exe control proc entry point
2 d3 [) S8 x; D' G& I0 wwhile running MeltICE.1 f( j6 ]0 A6 {7 V& `' ~
. b0 u. i5 X9 c8 V7 i$ E& |. p- z

5 _  Q7 j5 i9 B  00401067:  push      00402025    ; \\.\SICE
9 s: [; [8 C# C7 k: [  0040106C:  call      CreateFileA" x& Q. W" J8 C, T: n2 O
  00401071:  cmp       eax,-001, o. t' e) S6 e5 H: }
  00401074:  je        00401091& T0 a- \. ^, Y! f0 |% C. F  `
) G3 `7 t" S: t- ~
( |6 P; I& R, ~" M- I" N# r& k  J
There could be hundreds of BPX you could use to detect this trick.- c  ~" R7 l. n4 Z* G8 p% m
-The most classical one is:
" Y1 @2 h+ i8 i& ]" ?6 F3 _  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 P+ s- c9 S8 S  x7 W+ l
    *(esp-&gt;4+4)=='NTIC'
: O4 K& H5 C2 G2 H! [. k9 _/ C; e) F+ P% r6 s5 p* [
-The most exotic ones (could be very slooooow :-(
* \. h- J1 _- X7 y0 M; O   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
0 ]9 P6 q2 p+ Z: Q     ;will break 3 times :-(  i2 B9 X' j- `; Q

6 [9 }; A* W5 Q9 i1 T4 v' X7 @-or (a bit) faster: ( o9 z2 p  s, [) _2 k0 H  g( [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ y& W& ]/ L% y8 c1 l
* \& Y/ K) L4 V( \' W5 A* ^
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; I$ t: O' H. _, I: a
     ;will break 3 times :-(* b; ]. Q1 W5 @! Q( }/ B, ?$ u. B/ w
. }# U2 E0 z5 s1 z' R# X1 [" Q
-Much faster:
! y6 r3 j- ?& f: j   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV') q/ S  r  O/ l! B- |) @

  V/ j& z% s, n: }' DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen& F& B* U9 ^! d/ t3 y$ X& L
function to do the same job:
4 ?, T- [9 M6 b" W: |' D0 e6 s2 ~0 u& ^& v7 l2 @2 Q  X
   push    00                        ; OF_READ
2 m4 u5 M8 s! e/ ?   mov     eax,[00656634]            ; '\\.\SICE',07 t2 y2 i; v& o, o/ s  x
   push    eax
, F9 G+ X6 C1 Z5 @3 s   call    KERNEL32!_lopen
+ n3 J# n7 B' z/ q   inc     eax
  l& y/ W! S5 N' \. D$ K   jnz     00650589                  ; detected7 V+ W6 Z* j' f3 V7 L; p
   push    00                        ; OF_READ/ F2 S8 M' w2 X5 L+ E
   mov     eax,[00656638]            ; '\\.\SICE'. g; s- ^# \) _, N  q
   push    eax; F6 d+ X+ a" H. i" m, t5 ~+ ?
   call    KERNEL32!_lopen
8 E/ R/ Z- U' J' H  Q/ z   inc     eax7 d' C9 y% i$ s. [
   jz      006505ae                  ; not detected- z) t% Q! A" |# {. f* A
# W0 X$ G6 S4 L4 e  _5 t

5 T- z+ s6 m) Z: l: N__________________________________________________________________________
6 t' E3 P% n; [( [' t" @1 Z/ o
( e# q- S! D) J/ _- @2 d$ n; {Method 12
, n9 C1 ~7 s" s3 S. |) F=========' q, N' |& Q. `4 R% ~% p% F9 o/ r
- J( x" H: \8 d3 i0 `6 q# g, p1 Q& w: l
This trick is similar to int41h/4fh Debugger installation check (code 05
! W& T8 g& |& s* J# m/ [- W! Z8 U&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 T7 E2 |7 g. k1 x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" L% r. y/ s: j1 G
+ w) T; ?% S( Q$ I# K7 k8 |) G   push  0000004fh         ; function 4fh
3 L6 y# T: v8 x8 k3 R   push  002a002ah         ; high word specifies which VxD (VWIN32)! c' X) Y% V5 ]
                           ; low word specifies which service
0 b9 h9 I4 m8 s6 A( E9 N2 p                             (VWIN32_Int41Dispatch)( z. W# F' e# b  X
   call  Kernel32!ORD_001  ; VxdCall& z+ P! Y- I2 I
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ V0 B0 E5 w: I8 Q2 f7 ^
   jz    SoftICE_detected" ?- [8 g4 n6 g0 V( w6 r
/ l2 h; V" g8 Z: N7 Y3 u8 |
Here again, several ways to detect it:' k, g- r4 {3 ]# h# T9 y, J

2 ^+ x, u2 X8 y8 V    BPINT 41 if ax==4f
( L$ D; S6 h8 R9 t4 u7 r; E. a
- `: J8 u; R/ A0 w3 S    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one4 u  ]1 C% w+ x, I+ _, |) U7 r

. ~# d1 \4 b. e' e    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 F5 O4 S- t# M* n3 n- K3 W! [3 Q/ K! u/ c, [
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! n8 j8 {6 C, v1 M

8 U9 M* U5 p3 j! b. U3 Q- w* h__________________________________________________________________________$ }) W9 Z1 Y' f) B$ s, v( \

$ Q5 D1 K( @: W/ D+ |Method 138 J) m" b3 P7 u5 G/ K8 S
=========
. |- k$ n- Y+ Z
7 D2 Y5 k: I3 f% N: A  l: `Not a real method of detection, but a good way to know if SoftICE is/ H! T' i8 ^" H" X7 {  g# i0 H' j
installed on a computer and to locate its installation directory.0 d8 i+ }4 m2 W/ E$ l( ]% a
It is used by few softs which access the following registry keys (usually #2) :
9 A" R) h4 f. e  F
9 t/ J/ ~# V! B3 c' `$ R2 I-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* p, `6 U2 d9 h! f\Uninstall\SoftICE
1 P, m1 D: c) O-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
! e7 m- w9 ?! F+ ?-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& l' J1 {2 [0 l. [0 b\App Paths\Loader32.Exe
$ J) W% `2 T% E2 J0 v# v
. K% L' ^: ~. Z0 X+ s# Y/ u! L: B8 N! y2 e* D% r  d8 c
Note that some nasty apps could then erase all files from SoftICE directory! E# \2 p: j" W4 t! v7 T# Q5 D4 l0 ?
(I faced that once :-(7 `/ M( A: E* b& A, i

6 e' Z# C" s# S* x1 {Useful breakpoint to detect it:
3 e0 p% n& K* v: _+ x# R6 H4 w6 z
, g2 p- b+ ~& `/ v4 `( H0 C     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 X. K5 ~/ ~& }2 H: v6 v3 s

1 q6 Q) I. \4 \" l! i  A5 d0 J9 K__________________________________________________________________________, E: o" C: x. b9 J

' N4 W' [( j- I% g& h2 z4 U, f+ F/ n( l
Method 14   z3 T8 e; s  C' [% @+ z1 X
=========* T  c' C; w1 S/ z- j' d

- a$ p* x' O) U: [( @+ k  A$ t* GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) k* l9 x: d7 i/ d4 ?is to determines whether a debugger is running on your system (ring0 only).+ v8 ?2 |: Z7 }9 X) h# Z8 D) i

2 }* w/ o0 P; J4 B  \   VMMCall Test_Debug_Installed' S/ N: ]1 \( |9 M
   je      not_installed. x8 |' U  c8 i/ S5 @; A
" ~( h: r; z$ o$ r( j
This service just checks a flag.4 M7 a2 w4 O$ c& ]5 T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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