About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
8 S6 X& [# V& B! W% X& p<TBODY>
2 \9 W% O, B5 i- H<TR>
6 k* v! ~4 g+ R, _$ H" V, {* j<TD><PRE>Method 01
% J/ c5 i, L& q+ _/ w& S0 T. f=========+ l- Q" t6 m! z5 M5 _

5 I9 g/ ]- f1 h6 HThis method of detection of SoftICE (as well as the following one) is
) I" y: E0 A- V  eused by the majority of packers/encryptors found on Internet.
) T1 [/ f0 e* \: y- J2 XIt seeks the signature of BoundsChecker in SoftICE
0 I+ U' \9 u* H' z  l
& h6 }! V3 r5 Q1 Z. e9 @- ]$ M4 M/ ]    mov     ebp, 04243484Bh        ; 'BCHK'
% N# ?2 x' s# J$ Z    mov     ax, 04h; Y" t/ u/ j7 }& j. {( y
    int     3      
# E" Z0 H1 s4 M9 `8 a/ L    cmp     al,4) |6 k2 G& q- y, z% w& ^, b, J
    jnz     SoftICE_Detected# H( R% E0 o+ i9 }7 ?1 h/ u5 h7 z
+ G* c; V$ |7 y
___________________________________________________________________________7 Q0 w& g/ c' X
, t& }# y, t7 g, `6 C" @
Method 02
* i0 N* o( x( a8 S* K=========& C" \2 k3 s) R9 l$ m/ `
" V9 v3 {% O1 l9 f2 e. k  k
Still a method very much used (perhaps the most frequent one).  It is used" K& h. l) [/ F0 N' U0 @# A6 A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,  L+ Y$ Y2 H: Y" l4 W# S
or execute SoftICE commands...% E# i4 F! T: ]8 ^
It is also used to crash SoftICE and to force it to execute any commands! B. E# }) ]0 `$ ^
(HBOOT...) :-((  4 g' Y! I( R! J+ H1 \
5 ^( M& I" {. w0 O( `0 u
Here is a quick description:' U$ d. D8 H3 w' ?
-AX = 0910h   (Display string in SIce windows)% x" u2 U1 Y8 L- |7 q# X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx); C/ q7 W$ C- J' Q2 t( q6 d
-AX = 0912h   (Get breakpoint infos)% G/ J# V8 r: K
-AX = 0913h   (Set Sice breakpoints)
( U+ y4 B% d) o, A( v-AX = 0914h   (Remove SIce breakoints)5 b5 u: U( T/ s$ d! d/ Q

' h% v0 _9 ~6 h6 N$ W3 jEach time you'll meet this trick, you'll see:
8 U8 L: c5 U( r" g. C-SI = 4647h$ v9 t/ Q0 \& q* }9 f
-DI = 4A4Dh
6 Q* d# P2 A) mWhich are the 'magic values' used by SoftIce.$ F, e- s& v( U
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; d9 s, w* u/ x

7 A3 O7 x. d/ o  _Here is one example from the file "Haspinst.exe" which is the dongle HASP4 s; e! W* y' r5 g4 p% }: ]9 a. Z" S! @
Envelope utility use to protect DOS applications:
% `  i& G, L: x. W2 [' v/ u2 n8 e- C# }2 v
) F# o: D! P  s* a- Y
4C19:0095   MOV    AX,0911  ; execute command.4 q' H' K) t( ^
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% }# |% |8 Z( U3 N8 W' F
4C19:009A   MOV    SI,4647  ; 1st magic value.  Z; r0 \7 p0 @7 J. k
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
) ?( p) v" E. q7 [) v& [+ n, t: q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 W1 J' l" B2 E  Z+ ^, z% i4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: y. M6 S3 K: i% S% H% V4C19:00A4   INC    CX0 p' L; Y5 [* [; e# X# W3 T4 C7 W
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% Y3 N# Y; |& E, S7 ^! v
4C19:00A8   JB     0095     ; 6 different commands.! K+ B  @* r1 l* [" T+ L1 n7 X
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& b6 t: J* L. }4 m5 u8 X4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( g. X, |; k% j  e% _) P/ x7 l& X$ g7 S( q- c
The program will execute 6 different SIce commands located at ds:dx, which. R/ `$ a' S' n
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
; I' }3 M, {, n8 D3 A7 e; ?$ J6 u: M. _% R
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
/ n9 U/ _5 k6 n+ y) G- v  D5 [" l___________________________________________________________________________8 M# v% I6 u6 m* }+ \

  _2 K! z1 m! R6 ?% @
4 Y0 q+ t: L. j% F  eMethod 033 |8 y: |* r( L
=========
4 y' ?0 ~8 [0 e0 V! O! I$ m1 f; T
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
, H- `+ h" q" O& w- j0 F8 B' ?(API Get entry point)" w( l0 w# F" H+ [* H3 H! x
        9 k) u4 L' A2 N/ j( A

! W% ?5 }; x/ m' Q2 u    xor     di,di
% m/ t; K  |7 G* y; u" @. O' X    mov     es,di" V  r2 Y/ ?" Y1 H  d( X9 E
    mov     ax, 1684h      
% U7 p1 H2 S+ W5 G+ f9 t    mov     bx, 0202h       ; VxD ID of winice
$ u0 w) ^1 C6 q2 J7 I- v    int     2Fh  \0 w. x, I( b4 s: \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* ?2 [* K0 @& ?% @    add     ax, di
9 q+ \) e! R/ `7 c8 i# v; C    test    ax,ax
, R* s' R& c$ @4 L9 u# u    jnz     SoftICE_Detected) B8 d6 x% l: p
, U7 r$ U7 Z. ^9 X3 Y4 f  r
___________________________________________________________________________3 U* A" S; [2 x' D( n
+ ~5 O3 P" q9 n/ `
Method 04
# S* s# R* O1 k=========
5 N7 V' h7 u0 B) p, \& f% N" ~9 r& }" ]+ M" L# l8 y
Method identical to the preceding one except that it seeks the ID of SoftICE. O/ K) S. C' \* q0 k2 V: @
GFX VxD.
( l3 @& Z7 G- y* \% w: k8 @5 |  v
2 B+ o, B( W# i* ]' S0 H    xor     di,di1 p0 v' D, W3 Q' L2 o5 m( S' \( z
    mov     es,di3 O" P  Z: y4 Q- ?: `. p" w& G
    mov     ax, 1684h       % q' e2 j" ?7 B3 u$ W1 ]
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 n7 x- n8 k% [8 z* Q* ]    int     2fh
5 t& g: i1 v  I5 x    mov     ax, es          ; ES:DI -&gt; VxD API entry point" r1 A) |/ R. l7 e
    add     ax, di
% t1 ~% S4 H  [0 e( S# v    test    ax,ax. s; E# F" p7 Q  h
    jnz     SoftICE_Detected
% t/ d) x9 D6 R3 }4 U8 M4 H
6 V7 Y2 S. G$ k; O" \2 r' R__________________________________________________________________________5 v3 Y5 @- O9 }2 s. ~: g& \  b

! x8 R$ l* n: V, ]1 L8 m
2 f; T/ u! `: u( `  mMethod 05
1 i- P  c' e; d  q; A=========) A- l. ^+ ~! J( T
; Y% U! s9 E. ~
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) B; b( u8 s" X, b+ J  \3 xdebugger. It calls the int 41h, function 4Fh.  p5 I, c6 n% V. q5 p7 f! D! S
There are several alternatives.  
1 C' Q- P. U; J, V- f
- l" U% _: |5 s/ c# h- kThe following one is the simplest:
( Q: v1 N7 {* Z8 L5 F- S7 W; m' X) d& Y+ ^* Q4 w/ z
    mov     ax,4fh: e; i3 r0 F+ S
    int     41h8 ~% k: ?0 g6 m7 L  e8 _
    cmp     ax, 0F3865 U" N. Z6 n' n' j# t
    jz      SoftICE_detected0 A$ Z* v8 F0 a# B; |' ~
) X5 s; z$ ~) C* c& A! q: T2 t

* y' r6 L5 H4 K8 F- H- f8 u, ENext method as well as the following one are 2 examples from Stone's
( X# a  ^" M: Z) P# F4 B. {"stn-wid.zip" (www.cracking.net):6 K% o3 _. S0 Y, ]4 l! s

3 t  {3 s. Q& K' g. g- z8 w# S    mov     bx, cs9 ^, ]) r- F9 e( }* |
    lea     dx, int41handler2- r8 `  t* D5 w3 q* A
    xchg    dx, es:[41h*4]' q. P- m. O5 E  N: U
    xchg    bx, es:[41h*4+2]
' n& H4 N2 P' o% i8 S5 p- ?# c3 t    mov     ax,4fh
7 i# j" [5 f+ y' Y7 l7 I    int     41h
8 r$ l: T; [6 U4 v4 E  i+ `# I    xchg    dx, es:[41h*4]
& e( K% _9 [1 ~1 ]) U: I2 B% H    xchg    bx, es:[41h*4+2]: D4 f$ P6 V* v) n4 A& x
    cmp     ax, 0f386h
" ~& Q. E% B* c    jz      SoftICE_detected  B7 e/ r, p4 f: e/ d( O0 A
% o! G: C, |8 _) {1 r/ D- L
int41handler2 PROC
# C$ k5 v; u  {% L    iret$ N/ f; e3 t& W/ l
int41handler2 ENDP- t7 j. o5 M& C. H" S
7 k" l$ b; ~# D, M$ U4 V% H

4 H* A, f$ y5 _) X; a/ v& B_________________________________________________________________________: w$ ~  I9 s# p. \9 k6 F

) j. \0 c! F; M+ s+ \/ w4 x/ S  v7 b) J; _$ R
Method 06$ L9 a! G" n" c
=========/ L; Z) F, U, U, V- B( H+ O
5 x$ d6 V. e) L2 ~

/ _; \$ \9 `* |( a9 e2nd method similar to the preceding one but more difficult to detect:0 [( e% |2 Z) w2 z

3 m2 s. W% r7 H: l4 X) K4 N1 @* U  }7 U7 l" b" b$ v6 ^
int41handler PROC- j+ j. _7 @( X: @" F$ {1 z: F
    mov     cl,al
" F* `# J+ O% G: i5 ^- b    iret; P( P9 q. \$ C* V& Y7 @5 J
int41handler ENDP
' A9 [! I8 A- `3 q  R$ f0 V4 `' v$ J
& I$ [$ Y! N" \/ N0 N- T+ \
    xor     ax,ax
% {% V/ m  v+ {$ n! E8 ^  H    mov     es,ax
5 N  p: v9 h7 ]" j- C2 _1 Y: ^    mov     bx, cs
, o8 X  y! m4 ^0 M( K+ _9 z0 b  o    lea     dx, int41handler# @  |$ r( `& Y+ p6 S
    xchg    dx, es:[41h*4]
2 l+ o# J3 G! E, O2 G' i    xchg    bx, es:[41h*4+2]
% A; c7 B9 \! s$ S* a+ r* c    in      al, 40h( ]+ U; A/ N$ e, D
    xor     cx,cx! `9 I  r7 S6 g/ k
    int     41h* y; l. X5 R2 o, R. b
    xchg    dx, es:[41h*4]
) l( Y' O5 D. A% {! O1 g- I    xchg    bx, es:[41h*4+2]
( T. w" N" {+ ?, p) d    cmp     cl,al9 D/ U/ D% ~* t. [5 K# j! C) n) T, q
    jnz     SoftICE_detected2 h4 C1 X- g1 C

( ~2 q$ Q2 ]' i) l_________________________________________________________________________
4 E( T* e; v" @* m6 h0 n- \' Y5 U1 l" M
Method 077 D; _% r( P; Y( Z. G. j
=========4 @3 ?8 @; A. _: ]4 f
" @. S- F, P" g& I& ?; o
Method of detection of the WinICE handler in the int68h (V86)
0 T9 H% d2 ^6 G$ E; R& C1 Y' Y7 }  J. u0 \" ~, M  J& H) ^
    mov     ah,43h
2 Z2 [) ]$ B3 e+ ?& B; Q    int     68h
7 Z0 c5 |$ I5 h* A7 v    cmp     ax,0F386h  F8 K" P/ N( c0 O
    jz      SoftICE_Detected  m* N4 b, o9 A( v

$ o( @& B: A; q) c( f3 _
* Z6 V( X( |& G+ O' W8 d6 ^=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 L7 X+ N6 ^9 x, ]2 I
   app like this:5 G. H7 ]3 h* k, Y% Q

% f. i& w' L) n8 X   BPX exec_int if ax==68
3 {! G. p1 c; e/ Y- B/ h$ F2 d   (function called is located at byte ptr [ebp+1Dh] and client eip is3 e. ?6 d! K3 y, C! S* _0 J
   located at [ebp+48h] for 32Bit apps)$ t$ L* j6 y) Y* O/ i# w' c8 M* C
__________________________________________________________________________) S, W; L: J% X, K- l

) z$ ]5 C( V) v7 S7 H
' g1 D4 b3 B; d, C6 X8 |* M$ uMethod 08
; S. [. u: O0 \, ?- [, ^9 i=========$ B" s) L& U% u; H
! s' s' k& u* `6 `8 C& }6 [4 E
It is not a method of detection of SoftICE but a possibility to crash the
, ~5 X! I0 W: u( i) j: Asystem by intercepting int 01h and int 03h and redirecting them to another
8 F0 d1 }9 _- B1 t: Lroutine.
( I  K$ D2 I1 h: LIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: E+ S( o; B& F3 n8 nto the new routine to execute (hangs computer...)5 h# c  O/ r: m- ]* w  g

* ?; Z! \. ~7 X* G    mov     ah, 25h# j% W- R# Q0 l3 c$ R% T
    mov     al, Int_Number (01h or 03h)
, T3 c5 f1 B4 z: |% Z4 P    mov     dx, offset New_Int_Routine+ M9 M2 R- |" B
    int     21h
4 ^1 [+ F1 ~" p0 ^: B$ j9 a# F; I8 t& X: Q5 w8 L# Z, q
__________________________________________________________________________# H, |# }4 e( x- M
# d, R% H" c$ s: O1 ?3 k
Method 09& X0 \' _# p2 f" l
=========
7 n! D2 f7 t4 [$ w' G  D2 z9 Z3 i2 E. N( g' C' g: J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: Q" Q9 o4 z8 l* X9 e" ]  y' _
performed in ring0 (VxD or a ring3 app using the VxdCall).- u. |( l+ c( N2 E# M+ m
The Get_DDB service is used to determine whether or not a VxD is installed, L& C/ z" H5 ?
for the specified device and returns a Device Description Block (in ecx) for" ]: L. z2 A  P$ w' ^1 j) D  H
that device if it is installed.! Y- e) r: u! H4 B0 g6 y) a: |6 K

% G2 s9 K8 `% y, a' @+ ~6 u) ~  f   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID( _6 n# e- ]7 m7 Z
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 i. g) N- H4 k/ Q7 E8 @
   VMMCall Get_DDB- i0 Q; ~# [  N3 t& N% z$ s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 A! g& A3 j4 A8 u% v, |
6 p* y  o* Y* b2 J
Note as well that you can easily detect this method with SoftICE:
' l& F5 ^, `% U; C0 d   bpx Get_DDB if ax==0202 || ax==7a5fh
+ q( U& k9 X  [& x! a" l# P4 [
8 \% c. s7 S, S; R. [5 v__________________________________________________________________________
. L% w/ x2 R, [' ~+ j; r: X: b: n; D$ _3 ?" i
Method 10
# m" X' f+ ~  T( a; m0 D7 d4 i=========$ C+ e% x) ~3 @9 W  N$ ]
& Y# w" K* c/ q+ _6 M* t$ B( z! i
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( g( c& t3 q% R) J  SoftICE while the option is enable!!
6 u+ X7 _) D, i% x% d* |
- O1 o- g& y7 E* x: y/ UThis trick is very efficient:: M0 a1 O" K3 X) P9 X
by checking the Debug Registers, you can detect if SoftICE is loaded
5 g! W0 @6 n. E( n+ w(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
. n1 _) ?" L9 u/ V+ \0 Zthere are some memory breakpoints set (dr0 to dr3) simply by reading their1 h4 a# A4 V8 [7 b& G* E( `2 F4 `
value (in ring0 only). Values can be manipulated and or changed as well8 `: S6 ]; q% Y# b
(clearing BPMs for instance)
  e' w* \: P( W. y* J! h- A; _* }- e3 s. I2 e, Z1 n
__________________________________________________________________________' t. ^' I2 D$ ?  n- S6 ~# f$ r  ?

" W1 L/ o2 U2 D" K" R& n0 H. ~Method 11
/ I3 T2 e, P! p4 q+ ?( b=========$ m  Y/ \4 J! H$ b$ _" [2 m

& |& X* m/ X0 O; fThis method is most known as 'MeltICE' because it has been freely distributed
3 }5 O1 j. u  K2 tvia www.winfiles.com. However it was first used by NuMega people to allow
" s  e0 G% ~) M2 K( ?) MSymbol Loader to check if SoftICE was active or not (the code is located
$ J3 l, Z$ f# G$ \1 P! ginside nmtrans.dll).8 y% F6 E9 h3 [/ o
' b) M$ K6 {+ E* Y0 ?
The way it works is very simple:* _0 o  `. F. s! s$ L
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for% q/ \3 U) d) x' L- S
WinNT) with the CreateFileA API.; D$ J8 D# z/ m! K; {
$ v- \' W; M3 d( Y0 Y$ e
Here is a sample (checking for 'SICE'):# r; B! r; K' U7 ]4 E1 ~
. N: d% O/ V* ]
BOOL IsSoftIce95Loaded()
9 C" l7 |+ h. V. o# @- ^! i4 ?{' O6 H) q# ]' I& q6 X; V
   HANDLE hFile;  
1 H* r0 N4 b9 e   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* Z  M. v. \$ Q6 r7 u
                      FILE_SHARE_READ | FILE_SHARE_WRITE,+ V# f, z! _% v( u% M/ Y7 Q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 s; x! ~: e' w/ Q* O% R0 s* {
   if( hFile != INVALID_HANDLE_VALUE )3 e8 m# ?8 Y7 K' f
   {
, j7 _0 R4 b! Y9 l$ s4 C+ l      CloseHandle(hFile);
) T% t5 u# `$ o0 H      return TRUE;* M& M6 M* Y( }+ s. A1 ]* T1 q4 s
   }
1 p4 P/ H5 ], l) \6 A3 ~' Q  b   return FALSE;
. t2 q4 T8 ?0 e5 ?}/ X4 Q# k  P6 V  j; k; V

4 G* e+ t/ G# O. W% w" H/ C  HAlthough this trick calls the CreateFileA function, don't even expect to be5 {. Z/ g5 ?- x8 G
able to intercept it by installing a IFS hook: it will not work, no way!# }: ~- e1 e) [" K& V
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 y- n$ K  ~' ?$ V6 r1 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); M2 [4 A2 t; d" c) B. c5 [5 C
and then browse the DDB list until it find the VxD and its DDB_Control_Proc& W- n4 K! [3 L) @/ B( r6 H
field.  c' K3 c' G1 A2 D
In fact, its purpose is not to load/unload VxDs but only to send a
9 R! D! k# l. V* J; _W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
) z6 N. i& Q3 a( Tto the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ N* m+ V! h+ H# I0 D( q0 |to load/unload a non-dynamically loadable driver such as SoftICE ;-).! C4 F  n7 R' q3 V% ]1 O- p& h( g3 R
If the VxD is loaded, it will always clear eax and the Carry flag to allow" p2 a. e7 d6 F0 R
its handle to be opened and then, will be detected.
8 W: o) r# {1 p- LYou can check that simply by hooking Winice.exe control proc entry point
4 O8 a: _# Q% `+ u3 H, K5 ^$ P4 Xwhile running MeltICE.7 c' w+ J8 n+ t4 T% ~  ~

6 g+ ?+ I% ~) v0 H7 w- g- M1 X% e
" b& A, X+ O  m; e5 e! u! E, a: `  00401067:  push      00402025    ; \\.\SICE
  h' O; i6 W% u. r! J, U6 g5 q) M  0040106C:  call      CreateFileA4 q7 m( z7 ]! E0 @5 Y3 ^
  00401071:  cmp       eax,-001
, u5 R: @0 p& e' ?  00401074:  je        004010917 v7 n9 J8 S0 f! P3 [, g

0 ]# y( \7 Z: t) Q' O4 E+ h
# U" @" s/ x2 g& e9 }( M0 @4 @( m3 hThere could be hundreds of BPX you could use to detect this trick.4 ~# v; U0 ?) x! c9 D  P$ s
-The most classical one is:3 s/ O2 g0 [& a8 A- ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. ?) ?% Z9 L6 s% C6 T4 h6 J
    *(esp-&gt;4+4)=='NTIC'
+ ~6 ^4 f! \8 X* |- Z: a- `! w" Y, g" T7 u8 L5 D; F
-The most exotic ones (could be very slooooow :-(
2 u1 `9 g5 Y/ v' M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( h6 E" I5 }& ^  c     ;will break 3 times :-(
+ A  E" r" m+ C
& h; X& F% w$ A0 D-or (a bit) faster: 4 h4 V& m8 p" V5 K2 R7 S
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
/ `: q( P/ M3 L" m$ i2 d' j: }6 K# r0 e8 S8 j3 Q2 h- z1 [
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
$ ?3 c# E: F4 H+ _     ;will break 3 times :-(
! y* k9 ~1 V. s
( n* {0 `' B( K# f-Much faster:7 G: {4 v" j% l* m, W1 ^
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
! A3 p  e6 D  b3 ~2 @0 C
& l0 h1 M( Y6 j( a; p+ r% rNote also that some programs (like AZPR3.00) use de old 16-bit _lopen/ v& A% i2 H7 f5 u& C- a5 a( s
function to do the same job:9 `4 j* n6 B& _) t# S1 z
) }8 t; [$ W' A; j  w; d+ }
   push    00                        ; OF_READ0 u. B! w% q7 ?4 v" F2 K" V9 b# r
   mov     eax,[00656634]            ; '\\.\SICE',0! N' p3 }" j8 q/ E
   push    eax
# z9 w" _+ E8 g3 A' k   call    KERNEL32!_lopen7 {% d8 j# z) H
   inc     eax
9 U: S* F: p& U9 W   jnz     00650589                  ; detected
. O* W+ m  U9 G8 W   push    00                        ; OF_READ
( e  j5 v" Y6 Q) h   mov     eax,[00656638]            ; '\\.\SICE'
/ M+ N1 R' h* t! x# l: p   push    eax$ C: ]: s$ r( W: f( S( Q
   call    KERNEL32!_lopen
3 t8 {7 h7 Y, ~0 k" l   inc     eax6 q* O8 {, Y0 \- Q$ k6 r7 t
   jz      006505ae                  ; not detected5 p. c$ z2 e" C  c1 S
7 T( K: R6 E: l3 ?3 C1 ?
  p0 P* |- @' r) B. O
__________________________________________________________________________! h( V* V  H- K5 g
' w! i! t" O7 d! ]+ X
Method 12! @" m  Z/ w( f/ D& Z5 v- x3 Z
=========
: P7 A/ o& }% F  U# ~. H* \6 h& P" X) X5 R: f- k+ d
This trick is similar to int41h/4fh Debugger installation check (code 05% K. x$ R0 b! ^1 u. X" N/ v. I
&amp; 06) but very limited because it's only available for Win95/98 (not NT)% p- ^- M+ }# P2 i* F3 V2 z
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 Z+ ?0 ]% `9 G( u3 X1 j
9 j/ x1 v# [% k
   push  0000004fh         ; function 4fh
' Q6 v% c) M' m% D+ a" N/ A   push  002a002ah         ; high word specifies which VxD (VWIN32)
7 x6 l- x" H: {# \9 @% \                           ; low word specifies which service
! Y( c$ o7 ~: w& l6 n/ x                             (VWIN32_Int41Dispatch)- o, Q5 `0 K! H) \5 d/ [4 p
   call  Kernel32!ORD_001  ; VxdCall
  i1 X% n0 E0 ]1 P" q7 j- }$ |3 {   cmp   ax, 0f386h        ; magic number returned by system debuggers
7 y5 h1 F2 |, C" m* c) w, l   jz    SoftICE_detected, U5 X. s9 A/ I3 r( g0 T

% A" E. A& R" D9 W- o. JHere again, several ways to detect it:! f+ z9 X( Q* G3 l

+ P: V' k$ |; S% l0 Q6 ]    BPINT 41 if ax==4f$ c, Y! Z! u9 \

8 w5 ]3 ^/ A2 L    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ k/ v8 D+ g- P5 z3 d& e2 s0 E" N
( p6 X( n; W" }) e& w' i- n
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
' U$ r/ A: b1 U, L% s2 V4 a6 U; L1 `$ W* }4 K
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 ?4 c2 J9 ?  v% x5 `" p. J. J  F; w, g0 F. y% Y+ x, A
__________________________________________________________________________
, P* K) F- K9 ^1 z% m2 t$ d* n% j5 Y: V0 Y4 t. M  k/ t9 X+ W
Method 13/ N7 Z2 v' Q" ?# ?  t& d
=========' e) J. V$ ], P$ m
7 Q7 d1 d6 X1 _0 L; C" k. J, x
Not a real method of detection, but a good way to know if SoftICE is
" N9 j8 Z8 f/ b; Binstalled on a computer and to locate its installation directory.; O- ]7 U5 E9 f# J
It is used by few softs which access the following registry keys (usually #2) :
" P4 k+ z9 I8 J  \  }: H( C9 ?
0 r% W; k$ G- v-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion# |  M0 @( z' X" u4 z; }: [7 u0 x5 V
\Uninstall\SoftICE
0 r% V* s; _4 g) i-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' D" A) S; x2 R4 w-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion( n% K+ N. B- c' F
\App Paths\Loader32.Exe1 D9 k8 R+ f7 g* X% O  f

8 c5 `, C7 ?  {% l$ A6 P, c5 q/ j. G$ i/ ?; q
Note that some nasty apps could then erase all files from SoftICE directory
% s# j) @% l9 h0 y(I faced that once :-(
7 p6 k0 A1 ^- ~1 s
" k9 P: S7 u: P7 DUseful breakpoint to detect it:
* [8 y% q, I8 T& `5 e
: M/ n0 D. b& S6 t$ m3 X     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
, P& P3 E9 l+ s% k4 y  u/ b+ _2 g1 J: I$ i1 S
__________________________________________________________________________7 P; ~/ _; X( f1 K6 i4 L6 V! G8 s

/ I# R4 E- O: U* ~
- {6 o8 M  k- b' ~5 x2 P6 e) bMethod 14
# A+ V) d8 B& {1 K+ H9 @=========
* J) F' K4 t) M0 G* H
1 F5 E8 ^4 o# m4 h* I% }' fA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose$ v; x( F" u3 E8 ]0 v; S- g
is to determines whether a debugger is running on your system (ring0 only).3 C% j2 E& B) u$ ~$ A
4 m9 k1 u6 X. ^& m  b
   VMMCall Test_Debug_Installed/ n' r$ G9 T' S1 {
   je      not_installed
  p6 g2 y6 L" x4 _
9 _" O# N  Z9 y" Y. QThis service just checks a flag.
" y2 C) t! p$ O" y& G2 S. A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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