About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>5 X/ I; a, h7 Z! |# H
<TBODY>
3 a# C. y& T/ d" C' n6 y$ _% B" N<TR>
1 P/ n% O& s2 i/ `# j+ j* t<TD><PRE>Method 01 , s# P. P2 n9 p! s. z0 B- i
=========+ G4 |$ G$ m3 K# P: I4 k/ C6 f6 W

$ U( b7 _2 @3 A2 e; K" E- J$ BThis method of detection of SoftICE (as well as the following one) is7 H2 l: Y  U  }  G; \& l, V5 J
used by the majority of packers/encryptors found on Internet.9 L. t, i( ~, Z" D
It seeks the signature of BoundsChecker in SoftICE" O5 b$ F& I& _# I- ?
1 v0 w+ b$ a8 p$ t$ u5 z
    mov     ebp, 04243484Bh        ; 'BCHK'. k0 Z8 J! `: @( b$ A! _8 t& {
    mov     ax, 04h
3 S2 J( a; ~* E" R. G2 L    int     3      
1 J6 v4 q+ _( V4 A    cmp     al,47 ^: P& H3 Q+ S8 S7 o- A6 w1 c
    jnz     SoftICE_Detected
5 Z. {  ~& T* a0 e$ A4 C1 }8 a- Z. L
___________________________________________________________________________8 _7 K* {; u. U. t- Q0 X
  M. D) x7 T5 L' a3 Q
Method 02
/ k2 \( ^+ H/ Q3 e' `=========$ \+ y' O8 w. h

3 F/ d$ Z( K$ f) ?, B; O$ n# h$ ZStill a method very much used (perhaps the most frequent one).  It is used
4 t- F$ [! K' Z" f1 B. rto get SoftICE 'Back Door commands' which gives infos on Breakpoints,% G7 Y/ M$ P* q- ~) o& G
or execute SoftICE commands...2 c& Z9 \0 V. K$ d1 ^
It is also used to crash SoftICE and to force it to execute any commands0 P& I9 g, l5 G8 X+ s$ V# f, L
(HBOOT...) :-((  5 v) e1 r. M, I& Q& P& b

* n" G- ], |' n. u; ]/ KHere is a quick description:0 k. o& S- F6 Z( r  e9 c( I, [& ]
-AX = 0910h   (Display string in SIce windows)
3 o' O6 ~3 n% }! M' b2 g7 t& ?-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 r! g; Q4 q$ C( b-AX = 0912h   (Get breakpoint infos)! @& f* _8 u* Y2 @% [9 o+ F
-AX = 0913h   (Set Sice breakpoints)' u  u7 c* r7 W/ {9 N3 o) e
-AX = 0914h   (Remove SIce breakoints)7 \  W3 \% z' G8 C0 L, e1 U. E4 M8 \

8 ]& P- Q6 j2 }2 c) \6 V3 yEach time you'll meet this trick, you'll see:( C! p5 N$ M$ M2 _! k" r& }
-SI = 4647h7 ]& k' U  K* T$ E; D/ W) w  ^
-DI = 4A4Dh: O+ Y/ ]# F& S/ Q0 l8 o( A
Which are the 'magic values' used by SoftIce.4 x  c; s8 R0 p4 w
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
+ _) l- S3 w( q) n
7 C, e" H# r0 ^6 nHere is one example from the file "Haspinst.exe" which is the dongle HASP$ G. V7 @4 f1 S2 d2 f! T- `8 Q, f4 T
Envelope utility use to protect DOS applications:
' b' y& T) v/ K8 K3 v* U
; [; L1 O  U$ f: x0 x" m3 Z# R( v6 f* n, |
4C19:0095   MOV    AX,0911  ; execute command.
7 s# y% G2 }3 ~6 l4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).. l$ C9 V( U! n; D! l; B
4C19:009A   MOV    SI,4647  ; 1st magic value.
. B# U0 s7 a! i" n: `/ M4 L4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 w6 J4 ~2 p( Q. r/ j! ]4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
  u4 l/ ~- _, G. @4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! Y& ^1 O0 Z8 }4C19:00A4   INC    CX
: g6 d" _+ J, x) x$ S# l0 ]4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ [$ G/ i4 w, L$ c
4C19:00A8   JB     0095     ; 6 different commands.0 N8 f( B; S  S6 g  ]$ u
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) [+ m; J" |* Z8 T/ p3 r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)4 T: m. F3 M4 M" e; c9 y

9 S. x# W% r- lThe program will execute 6 different SIce commands located at ds:dx, which4 I' v; V# h$ X6 k, h
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- `) u9 |( [6 V' r, ^$ W' U- c0 |7 y( T, `6 [+ Q7 z7 w) t
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.' s7 m: G) T2 A! |
___________________________________________________________________________
( l+ g' J( S, W* o5 A* Y1 U1 _. P) Q( M( u( E
) s! x" N/ K: e7 n8 J7 q
Method 03
1 G" `/ _. K  F- |: ~4 F=========  J$ R6 d# d4 W3 T/ N% K; l( z

$ Q- V/ J9 v9 z" A+ m& cLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
& Y# d" F% C! }2 A  b  q(API Get entry point)
, \/ U# L1 E3 L+ M* L# j        
: c$ ^8 T* t" K- }3 B5 a: b- f) z: M# j1 y: g$ l
    xor     di,di" q6 N6 [! q. A
    mov     es,di
# g- X5 I! S0 [# [7 a    mov     ax, 1684h      
" Z! E5 @6 J$ h& T- m/ @, b    mov     bx, 0202h       ; VxD ID of winice' g; @7 M( ~. @- t, e3 E
    int     2Fh+ J* `. g* Y8 v7 i& I1 l$ u9 z; k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) Y$ C* S6 ?( g    add     ax, di
2 r1 j% @4 Z9 ^  e3 v    test    ax,ax
. Z7 B& Y; x8 w1 g) J    jnz     SoftICE_Detected% P) s  u6 e& x  r: m/ S- z

' p2 Z3 {2 G% P* J___________________________________________________________________________5 C2 d+ f# W6 q6 _% C" S
( x3 I- @+ R2 P) ]
Method 04, x& U( c8 p: D: T! K
=========+ `" t( v) l+ h: ?2 R& b8 |
% t4 K# \2 P! r$ a
Method identical to the preceding one except that it seeks the ID of SoftICE
  N6 d) V  i9 U8 U( R# z2 v: nGFX VxD.
9 F% j3 o2 b5 }! s
; P6 ^7 U. q% }2 X/ U    xor     di,di
8 g/ [: d9 G7 L    mov     es,di4 ?- V: a  O9 `9 q2 f4 a
    mov     ax, 1684h      
3 ?0 D% y- O" O. z$ n+ l    mov     bx, 7a5Fh       ; VxD ID of SIWVID3 o3 i4 Y( i; C  F& _
    int     2fh
2 \% Z0 [: |# N  V8 ^+ i    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 s, `0 K4 p& w% ^9 c( _, m. a    add     ax, di( b- e9 F5 T; W  L* p
    test    ax,ax
, r8 q$ }  W& u. B5 }1 |8 L8 m    jnz     SoftICE_Detected  F7 L! h2 D' P; }

# N" f$ |. G7 q' v2 h__________________________________________________________________________7 }! Q' \& t9 ^# W
' h$ S% b7 E: Z

2 @" L( I) \4 z2 \2 o3 I) BMethod 05
: g& F! Y* E% K5 ]0 S( `, [/ D=========
8 ^* M6 ^- b! O0 o: T* p
% E4 ^2 C; b' k" @3 a4 a- }: LMethod seeking the 'magic number' 0F386h returned (in ax) by all system: |, @3 v) Z( D8 p  }* I
debugger. It calls the int 41h, function 4Fh.1 B2 x7 A& L; T/ I9 a" g
There are several alternatives.  & n" l% Z( H, [& B

1 `# ]5 s$ ^9 RThe following one is the simplest:- a+ [- x2 X8 i+ b7 i

4 p$ H* ~+ {! H& C# z5 n    mov     ax,4fh
4 Y; R% |- n$ L0 o7 }3 H$ O    int     41h
2 [- T- f# L, T    cmp     ax, 0F386- j1 V! I0 Q6 h0 y
    jz      SoftICE_detected6 x0 ^; n- t- `2 b
8 u( d  X/ U  a# Q+ K) {3 _$ j& U( w

8 R4 M  @: ?* u! e$ u- INext method as well as the following one are 2 examples from Stone's , n) X( [; F( g& B6 }2 i% A. R
"stn-wid.zip" (www.cracking.net):3 P. p( j: E) a7 j+ ^1 {
4 e) k( C: f2 R- t* O+ L
    mov     bx, cs
5 e. y. c' @7 f# i* R2 T. s+ U    lea     dx, int41handler2
4 O" h! h3 I4 r0 d7 c    xchg    dx, es:[41h*4]
1 C6 Q% X7 v8 Z4 i    xchg    bx, es:[41h*4+2]
* v# ]4 @6 G$ N    mov     ax,4fh
: s) n+ W* b+ ~) o2 G1 B& n: J    int     41h3 w4 O. U" j% Z6 V" ~% \' }
    xchg    dx, es:[41h*4]
6 g( ]2 [/ l- i    xchg    bx, es:[41h*4+2]+ k  w3 `0 t8 U- H% v& P
    cmp     ax, 0f386h
6 ^( l) w5 `" o  _, Q# S    jz      SoftICE_detected, H/ m. {, Y) ?; M

0 h0 ^1 R7 Q# _3 m. I# M; ?: T. S1 Wint41handler2 PROC! j. v8 X: w0 Q( s
    iret! p  H: P8 R0 G! ?) ~/ {% B. r
int41handler2 ENDP
/ F& P( k. j' I8 T- l, x  K% `( j# X$ ?

: g# k; E8 S+ l' X9 g_________________________________________________________________________
* i& p6 _( @, k( h& L7 x; P' f# w
0 ^8 q$ V# d* ]( [: D
% f6 E& v2 v# v$ C. N2 XMethod 062 E; W2 |, h9 \
=========5 H$ O# C1 ^! p# e/ w, X7 j
! z/ y8 D9 I! Z/ A% y) T
+ m* p- b5 H& ]% |5 m- ?
2nd method similar to the preceding one but more difficult to detect:
5 ^4 o, R! ^; m# h) E+ ]( ^1 o; Q8 ]. O/ s- }$ O- j: v! W

& x. u  P/ \* W* q; Yint41handler PROC
8 \/ N$ |/ ?' V# L1 E5 Y( v' n    mov     cl,al3 h, b& ?: z+ Q
    iret: a- F: b4 M7 G+ g9 J, Q
int41handler ENDP
  e: Z9 Y9 N1 ~7 L* K
' a0 Q1 u  \- t' Y% l  p
" t  y9 i$ T; u; t6 D! K    xor     ax,ax/ Y9 Q* T* D3 F- J
    mov     es,ax5 z; \# s2 \7 T2 B! J1 l
    mov     bx, cs  t9 T5 i, Z2 w
    lea     dx, int41handler8 {/ G( E  x6 `$ R& N! M; z
    xchg    dx, es:[41h*4]2 {' l3 n+ }1 s4 b5 P- K) {
    xchg    bx, es:[41h*4+2]
2 P+ f9 X% l5 w; w" |/ s    in      al, 40h! v/ [7 H' O/ q1 _( \
    xor     cx,cx
% c; \+ z# D7 l" A    int     41h  e" \4 e! ^& Y' e1 @( `' n8 |
    xchg    dx, es:[41h*4]; b; I' h! ?/ C8 }% `' H7 W
    xchg    bx, es:[41h*4+2]
; H) a3 q; B; a; [$ r; u9 Q    cmp     cl,al
' V7 t$ t; z, _$ r: L/ \    jnz     SoftICE_detected
% _" r+ V8 R* G5 n' x3 f; `4 ^6 W4 j+ H% x( \1 z1 |
_________________________________________________________________________
, P" J+ Y0 e3 T. g9 S) ~! Z" o
Method 07
* e! s! K) R( j' u=========
- D/ g7 I1 n  {4 b1 q2 R* |, L! G% _
Method of detection of the WinICE handler in the int68h (V86)1 i/ [  w/ A- v: Y: [" a9 P

& a( u/ M  _* `    mov     ah,43h$ C. s8 s+ [) ~/ D, f" a! h
    int     68h; h3 j, J3 M; t2 V) j4 k  u  P9 `
    cmp     ax,0F386h
% X: ^- m8 F  @  n. _0 ~    jz      SoftICE_Detected
. P( O. q$ U, _! L
- ]. K! |; K: |, H, v' r# w; ?8 b) l
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& L, ~% O4 S; @2 i$ X   app like this:
- c) }- M7 N2 Z0 t8 t# @3 b* r- |+ G2 N, `: J5 a
   BPX exec_int if ax==68; a3 O% E: Y: p4 n
   (function called is located at byte ptr [ebp+1Dh] and client eip is7 A0 z, f/ b# R* K6 y: U! v
   located at [ebp+48h] for 32Bit apps)7 g3 s( C& f1 w7 w
__________________________________________________________________________
) h2 X8 E- B) C! q$ j6 ?' R- B4 f/ d7 N, z' D0 i

, u; T' ^" l; `  OMethod 08
9 j' Z6 x+ e8 ]; V9 P+ [, U' @=========1 `7 |3 ~# |+ ^
9 h  R/ I3 T$ B7 c
It is not a method of detection of SoftICE but a possibility to crash the
/ A$ A0 }- ~) h+ Bsystem by intercepting int 01h and int 03h and redirecting them to another( T. x; U( b+ q) }/ z1 \0 f
routine.
; f, m1 Q& a4 j8 t$ BIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 X  a: p, A  q* cto the new routine to execute (hangs computer...)8 l" D: C8 @0 Q/ t" o
" Q! {$ r# w+ v* v! K
    mov     ah, 25h
& _0 _* ^7 b/ d. ~& W7 F" e    mov     al, Int_Number (01h or 03h)
, J' Y% }/ [( d4 S2 a. ^1 I    mov     dx, offset New_Int_Routine
1 E8 _4 `" |5 l) n6 S    int     21h0 `/ [" W! R* u: h, Y  ^6 J

2 U5 {$ Q3 Y8 A6 ^% J% Q( z__________________________________________________________________________
. N0 f# S- i% J. }) u
" d5 P1 K, c$ d! l) }Method 09
- q# m1 A, x4 s: I=========
4 y1 R, z- w6 N6 X  S! @7 Y6 ]
& {8 r3 x1 o) U3 W  RThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& Y6 X7 Y' Q/ G/ l) K8 [performed in ring0 (VxD or a ring3 app using the VxdCall).
* x4 \* T; s! u; X1 h9 X- _The Get_DDB service is used to determine whether or not a VxD is installed
9 d- m$ k4 T3 @# Qfor the specified device and returns a Device Description Block (in ecx) for
* E# R" N$ I6 D) |8 b8 `: K3 e/ Mthat device if it is installed.1 o  N4 g, ~1 F# H

8 M# I- X& d' {! N0 M  D, U% q& I   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 B' T; U5 S3 l& K1 W. B- u$ u
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
7 _7 }! j9 e3 S* Z! o   VMMCall Get_DDB
2 U- x0 {& W' U, y   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
* J5 k: @1 h: Z3 v
+ ~2 P! t. _% c6 n6 wNote as well that you can easily detect this method with SoftICE:; L. ~- q3 O2 }
   bpx Get_DDB if ax==0202 || ax==7a5fh
1 L9 U" G) W8 s3 u, _( Y% e" {' O* ~6 a( d
__________________________________________________________________________$ H6 }5 O: ~, G1 h' z& y. T

2 q! D8 D8 E6 Y6 XMethod 10% a, f2 U) A3 g) c
=========
1 ^) z. F5 B3 C6 H
+ n' P3 g2 W/ v, k4 {=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 {8 q* ?( b) @5 D2 \
  SoftICE while the option is enable!!
% }1 c+ b: s: E6 _
1 c8 E- n; n" l' }6 nThis trick is very efficient:3 ^' |2 A: k- ~8 W% O/ Y
by checking the Debug Registers, you can detect if SoftICE is loaded
* r, W% D6 ^& M+ L! z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
- ]6 Y4 S" V8 ^) o$ O* s4 Z; a$ x! f, athere are some memory breakpoints set (dr0 to dr3) simply by reading their! \+ s2 Y3 }; M9 \- [) z/ M
value (in ring0 only). Values can be manipulated and or changed as well
# ]9 D! S$ P6 J, `6 n. W' J+ [1 D(clearing BPMs for instance)
, N6 d! o7 G* S: [, |# V
2 Y5 ?) w" J" S# d7 L6 c. u4 A6 R: w__________________________________________________________________________+ D( x6 D; K) R0 o2 |' E6 p

8 ~7 J7 r7 c0 ^: mMethod 11
0 V+ n$ q6 m) v- X* t1 L! n9 A=========
0 l' A9 v% y6 z; v$ D7 {$ d. ~# _) S% W% }  ?/ K" O" l) s* P9 Y
This method is most known as 'MeltICE' because it has been freely distributed, D% a) r; D' a$ ~7 w& g% {
via www.winfiles.com. However it was first used by NuMega people to allow: Q1 l9 {/ C7 F/ W* m
Symbol Loader to check if SoftICE was active or not (the code is located! |1 ^) j2 {/ d5 d$ Q8 V% a
inside nmtrans.dll).
& f; R) c1 L/ O; C) C4 I
7 A" L2 x1 w4 h' o& K, W5 XThe way it works is very simple:8 S. }6 a- z- O+ p9 n
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 Y; w" q! ]& [# ~
WinNT) with the CreateFileA API.7 w7 {$ n# L5 P! y

- H  k+ _' H) M3 u8 a/ M2 }8 `. X. gHere is a sample (checking for 'SICE'):- ~/ Y+ t; h7 [* _
/ X* I. z# ^* ^9 d
BOOL IsSoftIce95Loaded()$ e5 U  L1 V' ~4 H- q; I9 o
{
) M, @: e( I" d7 Z8 u# f   HANDLE hFile;  . [$ D* S# O* Q% [5 v4 {! U
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 Y' P! A4 `$ j/ T+ s7 `                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- Q( y/ T3 q- ]* t! C. q0 ~                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. [& d: q0 U. T) Z' Y   if( hFile != INVALID_HANDLE_VALUE )
8 k6 t6 X4 F1 J$ [/ ^+ V: q   {/ z* N+ K  Y, a
      CloseHandle(hFile);1 I3 L' Q' W5 C/ p9 i) M
      return TRUE;
. L  L, l' g: R8 S% t; b8 O   }: ^4 U9 e3 i) I3 I& l0 k/ |
   return FALSE;
/ K4 Q0 l6 f+ q- r5 O, C6 f/ s& r}
/ O% X  `+ l) i' d
* D: v8 q% i- IAlthough this trick calls the CreateFileA function, don't even expect to be
2 y) `+ T$ O& U* D! K# u6 @$ }able to intercept it by installing a IFS hook: it will not work, no way!
) v! e% L% [5 k9 z2 S% k  RIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
/ Q  v, I3 ?& r7 W" n* T& aservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( A# j9 I: Y. ~& S
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
, V5 Q. p/ m* Y, z* C/ Ufield.
. u) u+ i0 h1 I8 _In fact, its purpose is not to load/unload VxDs but only to send a ) J4 {, F# ]+ d$ Q* s+ X6 ?+ n( p! r
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)+ B9 W/ L+ G: R! O3 d
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ z4 j' y$ G* eto load/unload a non-dynamically loadable driver such as SoftICE ;-).! ~$ x' S" S9 R
If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 ?/ N+ B# L2 G! fits handle to be opened and then, will be detected.4 M; }& {% H& P* W& |
You can check that simply by hooking Winice.exe control proc entry point
6 A! X2 w6 {! z3 o# k* `while running MeltICE.
! z" ~2 x7 S$ M6 z9 N; U  v9 H" g
; m; Q" }# L7 Z9 I& F# l2 H! t) ^4 p2 A, d/ h2 r
  00401067:  push      00402025    ; \\.\SICE
2 d4 Q; Q$ K% g+ S1 @  0040106C:  call      CreateFileA
) A6 k) z, ]9 T) I8 E% |% u( L  00401071:  cmp       eax,-001
3 O. \4 O/ m& @1 l' y  00401074:  je        004010916 E+ |" J2 f" |( p3 U1 k
1 [4 F: y1 j* Y+ {. \

3 i4 ^/ T4 z+ p2 O3 F# l9 UThere could be hundreds of BPX you could use to detect this trick.
+ m; \. w, v, e" Q6 ~! |' c! l-The most classical one is:
4 v1 H: ^9 e. Y6 K( P  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||+ V: ]0 b5 q" K0 M. s9 H
    *(esp-&gt;4+4)=='NTIC'
) Z; x- p: C9 A% l9 p: B5 V
6 g; D9 p" m+ E; M! J7 G4 _) V-The most exotic ones (could be very slooooow :-(
0 J! F, |& u* C; N   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! f' l$ ]) c: h# t7 V6 _
     ;will break 3 times :-(
" Q& g- [# t- P/ J3 L0 _) k4 Z5 r
9 K/ X4 \9 ^( {! N-or (a bit) faster: 6 J+ W7 M# {5 W& L3 m
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, J* r3 C) z( S/ @
- Z/ m' ~7 w$ @/ g) H! q" k   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . S) p  Q* _0 H' ~4 {, q' e
     ;will break 3 times :-(' V8 z& v. ~8 Q3 g( ~, s" i

# _4 I" m2 ?; ?-Much faster:! z2 v9 }- [* b, R$ n( c4 h
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. c5 \, z/ B5 S5 S. T3 \( y
( ?" y. I5 k/ ?8 A( C$ [- D' Y$ g
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 z7 {2 A% S! x3 N6 W* I
function to do the same job:
( }8 L; A  P8 P
. I% z% I" W8 F* L% W   push    00                        ; OF_READ
+ ?' F- x9 R3 z   mov     eax,[00656634]            ; '\\.\SICE',0) w8 ^6 b# `( E0 M. _
   push    eax
1 w3 y5 D  v; j: `# P0 R   call    KERNEL32!_lopen
- H; ~% x7 E" D" f4 G4 z/ J, |2 y   inc     eax: V0 n# g# |7 k# E- U
   jnz     00650589                  ; detected
2 o6 T$ [6 u% d/ M' G   push    00                        ; OF_READ, h1 k: q0 M- H
   mov     eax,[00656638]            ; '\\.\SICE'
7 E7 h) y! O$ k& e5 D; U( e   push    eax' D3 O3 J) w# c  d6 B
   call    KERNEL32!_lopen
# l0 v- q- H" [   inc     eax
; `7 H: B4 A+ X* _3 X+ p& Q   jz      006505ae                  ; not detected
1 n+ C/ s7 a7 [& ]: X& j8 d3 @4 i3 }/ I1 y
- t' w0 T- ~$ U/ X) {6 @4 x
__________________________________________________________________________) x( G( Y2 z3 d0 t8 N& Y2 Q3 _0 [: Y

! n0 n4 m) d: g$ n% ~  \Method 12
/ _# Z) v" I+ ?( ^=========0 H  g. S% ?) [  v6 g( X
% p. s- W1 F" {* \9 v
This trick is similar to int41h/4fh Debugger installation check (code 05# f! d; Z7 q4 i
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
8 L" E9 _) v# gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  H7 T$ I6 T8 l$ ]* \, ]1 v7 j- H( m9 Q2 v$ @6 J8 w
   push  0000004fh         ; function 4fh; @* n. [/ N1 P& e1 |' W! X9 p
   push  002a002ah         ; high word specifies which VxD (VWIN32)+ ]. z3 d% e4 s5 A
                           ; low word specifies which service( Z6 K! X* P  f1 C/ n$ Q+ U
                             (VWIN32_Int41Dispatch)
$ H# \4 q/ s+ ^6 x   call  Kernel32!ORD_001  ; VxdCall$ h% y8 p/ M, H
   cmp   ax, 0f386h        ; magic number returned by system debuggers* F8 B! ]$ ?2 N) r6 u
   jz    SoftICE_detected0 i9 v/ C/ O$ i5 h, @- i

( v1 t. \' z9 g% U: P+ S: Z; |Here again, several ways to detect it:( @0 `0 b# ]5 T# d
9 _& Q1 u+ z9 P4 c3 b, X9 O
    BPINT 41 if ax==4f) w9 E) j: A( T/ m

/ Q! w' _2 w; g& i4 T    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 a: s, S6 O. J5 j5 F* l
$ U, r/ A6 Y$ _* `# m0 C
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  W$ W. f$ E2 o5 O8 ~9 u/ R

( e4 ]# A8 u- ^" h) O6 @: \( L. _5 g    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
: I2 b: V, C3 f1 V' F7 n
' d" @4 Z8 u$ t6 L1 {+ @* L__________________________________________________________________________
( k( R0 v& Y# y, Y; d0 @# `% B
( b0 u# L7 m; i: c  Z9 v9 p- J# cMethod 13
5 ]6 \% c! M0 o- [=========
* _4 E* F5 Q( n( B- ~
, G) w1 H/ p" p. Z7 h0 bNot a real method of detection, but a good way to know if SoftICE is0 o; I/ E. n1 w
installed on a computer and to locate its installation directory.& A& R6 F; N- U6 f' t4 V
It is used by few softs which access the following registry keys (usually #2) :
! U, n2 \- }' @! h4 Z: r1 U* g' ^- \4 U) L; t. X' i7 a) f  h. U+ e
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  P7 C& G; ]# l3 T\Uninstall\SoftICE
6 G% X  X; @+ s- y0 u-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- Y/ T$ J$ ]8 Y" e4 I& ~
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
& z0 ^9 t& c, L0 ^/ O\App Paths\Loader32.Exe
- x- Y; I: }. R2 g
* L" M4 \8 V; b( H) E/ r
) _" `* C  N. k: j/ ?) Z  cNote that some nasty apps could then erase all files from SoftICE directory
/ Y0 m7 a+ e" c# C' H0 J(I faced that once :-(
4 h+ L. j( y: A: }5 r" t/ h' |9 N4 r$ L+ I
Useful breakpoint to detect it:" H2 \9 z7 U9 S# p8 t

5 U( y: @# u& F  o     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'" c% m, Y4 u# x7 x+ F# K2 i% w

8 P( m1 s, @2 C2 Q8 o+ I__________________________________________________________________________
5 D2 C: N& O" J5 W2 K; B
0 G, V6 E9 z  d: c6 h' F$ g
$ u' ^. m9 m- Z1 r% kMethod 14 ' }4 V. Q4 ~8 P
=========
1 K  \( e" m& t8 ~
! H9 V: C. I. {4 K! b  EA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ E  K: {( D1 q6 K) xis to determines whether a debugger is running on your system (ring0 only).- ?4 e9 m% S& i1 P, z

8 E+ Y5 H( T; u! o+ @   VMMCall Test_Debug_Installed3 Q  x) U4 `0 s6 S2 O0 g8 k
   je      not_installed
: I4 m4 |' O  s) h/ a8 n0 q) B  g6 I# Y' x+ K
This service just checks a flag.3 s7 ^* k8 g4 e! k. p
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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