About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 U. H; D0 }. x6 Y
<TBODY>9 s# ^; N  f* A9 p  @* z( v4 c2 n: O# M
<TR>+ C& a% n3 _5 S  Z3 L' ~
<TD><PRE>Method 01
  Q1 B. B2 N& j3 h=========
" V6 Z7 b# g' }# O: ^! i0 {: P! j2 @- A1 }; v9 s
This method of detection of SoftICE (as well as the following one) is
) g( e+ o) B3 U3 b2 ^used by the majority of packers/encryptors found on Internet.$ v' e+ Y9 U* N! `( E
It seeks the signature of BoundsChecker in SoftICE
; P4 ~- q3 a. Y' t0 K. y) {
; Z/ \7 [2 V$ f$ |3 H6 y0 I) ]+ ^    mov     ebp, 04243484Bh        ; 'BCHK'& {; N' N* H, G7 X$ ^. e
    mov     ax, 04h! A$ _3 M! |8 P, c
    int     3      
6 M+ E# U, |8 {, T    cmp     al,40 Q4 ]" v+ S7 e1 \# n
    jnz     SoftICE_Detected
; W: A  @' r- {3 o, U1 s* {0 B
+ x1 G& h4 y1 M3 M0 _! P2 o___________________________________________________________________________
' f  g* F% w+ f) t  u7 U; K. O/ H+ t) ?4 q3 u) {. ?* v
Method 022 K9 z3 x( v" B: H" q$ @
=========+ p& k3 f, G' K- @2 @6 S4 A

% K* t  N1 q- c% q: X7 y0 v8 F9 sStill a method very much used (perhaps the most frequent one).  It is used# [4 n( A& B5 O" F9 V( w
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,* K2 [" V2 n1 f" I) a
or execute SoftICE commands...
$ r; P; Z* C# R& qIt is also used to crash SoftICE and to force it to execute any commands
" S! a' E1 n; ]; N8 R- N. L& w* U(HBOOT...) :-((  
4 _  W' k- F  @/ `4 f5 d- U, y8 r& l& h; ?/ X2 q0 b
Here is a quick description:
: B; ~8 C& h5 c6 D( S-AX = 0910h   (Display string in SIce windows)" O" j6 u4 f- f( k" e+ ~% {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 N3 D2 K9 F+ ]- u5 ^! N1 p- I-AX = 0912h   (Get breakpoint infos)- l7 N) }) y) A+ M; g
-AX = 0913h   (Set Sice breakpoints)
; C2 A: W" J% b-AX = 0914h   (Remove SIce breakoints)6 {/ G: L! S8 @6 l- Q! x0 j1 Z

* p0 u, ?% r7 nEach time you'll meet this trick, you'll see:3 d  |: K$ a; D; A
-SI = 4647h# Y8 [9 }3 @8 P9 g$ m3 ?: ]
-DI = 4A4Dh
7 Z6 i2 e' m- o% O2 ]Which are the 'magic values' used by SoftIce.
  e) X& J8 _: O' m: h# u  ]& S: MFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.+ E! ?, y! `( z! p
0 _8 D1 {9 g- p7 g( z8 v" |- l
Here is one example from the file "Haspinst.exe" which is the dongle HASP8 P. Z5 |" _" |  t7 D5 }# }: q
Envelope utility use to protect DOS applications:, n* n0 Q4 ~% }( r' B

) G$ n  e" [  W& Q9 U" h! z& P. O: e7 _+ M/ ^
4C19:0095   MOV    AX,0911  ; execute command.8 W8 R# x- I" Q& X! K1 B) M1 J
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).0 g6 X2 |! A' x5 H) b4 Y+ l9 U
4C19:009A   MOV    SI,4647  ; 1st magic value.7 {3 P/ l) m; S* g
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ x4 B$ N$ x, X7 g4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 Y9 C/ W9 m; ]9 h
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& e; Z5 W" L2 `4C19:00A4   INC    CX
! X# ]1 d1 f: H9 x' T4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
, I2 t. }( X! p4C19:00A8   JB     0095     ; 6 different commands.1 F  A6 S0 E# A- e4 d* o4 @% y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
/ i" }. h1 z' z( V3 |- J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
  E' d8 D! r; s1 c: D( {
: ?! Y4 Z% @1 }The program will execute 6 different SIce commands located at ds:dx, which. b% L, x( ~6 k( V$ A
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: X; o& e# s5 g
  R7 o# \- k' d+ x2 F0 L% Z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# \, G1 h2 F  {* Z% p0 V4 k
___________________________________________________________________________
# N$ ?& H& {. _* Y
; {# R$ e9 Q( x9 ?  _; p7 `5 l5 ?; d$ Q$ _6 _6 }) w
Method 03" Y1 e2 L( b8 X7 w* H( y
=========* L+ C, e' N2 a" E/ o6 K1 h
, X2 D; ?0 a& }/ S9 j& g( r
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h* ], i1 G0 f- C+ c8 m( J
(API Get entry point)+ m6 ^( G0 _: {8 h) q
        
$ ^4 Y' X' _. v9 C: _7 {8 G5 m) b) d
    xor     di,di
4 f- c8 e  A  i! a    mov     es,di
. r* _$ c0 B% N: B    mov     ax, 1684h       : Z+ z; |+ V  L
    mov     bx, 0202h       ; VxD ID of winice  y5 L$ X* p" `1 b2 d7 O4 R
    int     2Fh
$ y6 a, S3 K* y    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- d0 k# T8 S; w6 e6 W1 d0 B5 H2 D+ F    add     ax, di
$ I% h1 ]( z3 ~4 U    test    ax,ax! t- Y' b! s( Y5 \+ z9 M
    jnz     SoftICE_Detected6 G4 G0 V! z) w6 d* T+ d
+ R; d; j) w3 }( h; g9 w  H  n5 a+ p  g
___________________________________________________________________________: c. g' d  H' E5 l
7 T+ Z/ ^! K9 J, S' N
Method 04" B' l) _) m$ h+ |
=========
3 p  {+ a6 U7 r- [7 Q4 v. b- l: H3 a% H
Method identical to the preceding one except that it seeks the ID of SoftICE
: N; b/ Y5 R$ j+ {6 |6 nGFX VxD.
+ I; U- [6 a8 F" v4 B
- V6 H) H6 G- J3 L8 T. R% G5 s    xor     di,di. q7 d# ^' |' W2 l" \( }2 I
    mov     es,di# j! a: Z, H0 F2 t& T0 D4 c
    mov     ax, 1684h      
% H3 q* B+ o* L+ o    mov     bx, 7a5Fh       ; VxD ID of SIWVID% `2 D6 w0 r9 s; f- P. r
    int     2fh- X: z4 E' Y) }* ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& D& Q0 ]- g. e* p- @+ A8 R* F    add     ax, di
: \* u) d8 b! S! b% Q' L, ?    test    ax,ax
! `+ I) f) o. m. ]4 w    jnz     SoftICE_Detected) p6 V) D' }7 Y+ ~3 {7 b

3 q  X+ z2 O- m__________________________________________________________________________
/ d) k8 @; [2 t" q
) D, m& @  q2 x, t
' {: ^8 q1 p  X" D2 hMethod 05+ O' p& G! Q9 X- b! ]4 D
=========
8 a$ H) Q( ]* f( U( D. \
5 t# _/ r. r) ^Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 Y4 H- U4 z+ W1 a* k- p+ t7 n" bdebugger. It calls the int 41h, function 4Fh.
0 U2 T+ i! e: p& w; T6 CThere are several alternatives.  : q' @0 h+ ?  U: ^* J

. I/ w! J/ k* r% z2 A- [The following one is the simplest:; c+ o0 E8 m. ]1 z; U
2 r- @( v1 y6 Z4 ?2 o
    mov     ax,4fh
2 w" u$ o( Z: `1 @" C9 S4 \    int     41h
* l$ \# \3 `5 n- D2 L    cmp     ax, 0F386( ?  U' b. [$ `  V6 J
    jz      SoftICE_detected
/ `  w8 O) x4 b( g0 @4 ~  ^0 ~4 N6 f( x1 v
0 Q! ^$ r# ~2 b* f5 g
Next method as well as the following one are 2 examples from Stone's ! o& l" L$ U$ B  c# N0 @
"stn-wid.zip" (www.cracking.net):
1 I' l1 ^7 k, a" L4 V7 v1 l9 U( g9 L( H2 Q. _# Q
    mov     bx, cs" _! k1 A! h# S1 {) ]5 |+ Y; e$ {; }
    lea     dx, int41handler2+ B) q3 E/ h9 P* f: a3 m& Y" F
    xchg    dx, es:[41h*4]
: F( i& t0 i" j    xchg    bx, es:[41h*4+2]+ L3 t2 D' B8 h: W" d
    mov     ax,4fh
5 P& n1 U0 q# {2 u: @4 a4 X. _! `6 J    int     41h
4 b9 v: e. K5 O: t7 s    xchg    dx, es:[41h*4]
2 z3 P3 q* }- j3 [8 Q    xchg    bx, es:[41h*4+2]" s7 J9 a5 L0 \) u- C& \  B- v0 b
    cmp     ax, 0f386h
7 D( t3 h4 }2 G( f    jz      SoftICE_detected
' F% E. v9 G2 l7 Y) N2 A; G" [9 }1 i# X$ K! U
int41handler2 PROC
0 W- ^# @9 {$ q  [$ u    iret( h$ f- B+ i! x5 _% f# c
int41handler2 ENDP
! Q& L) c6 m3 b( K# @/ Q. f* n( w% z( C6 I* ?

) `! |4 O$ I/ A. q. z_________________________________________________________________________6 q# f* j+ a# O0 g% }

& C; k1 J8 S- G( `9 @* M( I8 n$ ~9 R
Method 068 X; [! |# u# V1 z3 u# I1 w- ~
=========
* k. E7 \! A) {* S  u
: h: h+ Q3 o$ k6 }" s. z' ^% N/ x/ Q" U$ U
2nd method similar to the preceding one but more difficult to detect:, K: V# C3 `' I- \
: X- R/ k0 T2 _. A  n
4 Q# T% i8 u/ |: `3 M
int41handler PROC
4 |, r: {/ T8 S8 D$ W% U    mov     cl,al% D+ q2 N5 |& s1 K# W+ }# T- @  `& C( d
    iret- v$ Q, o  q0 F# C8 X8 t7 r2 B
int41handler ENDP6 `9 x5 L& c0 [7 S
& Y! \6 ?% M0 k5 h$ b

: D% B) z+ t" @) R" M    xor     ax,ax; ?. w* P/ k: y, B2 r9 z8 J
    mov     es,ax
4 a; q: n5 c6 h) q    mov     bx, cs
5 s7 t! E6 v( F0 u+ m! x    lea     dx, int41handler
" ^# P+ c" A2 Q4 Q( b    xchg    dx, es:[41h*4]
+ Z  o  k/ h. c/ P4 n! E0 X( L    xchg    bx, es:[41h*4+2]( w5 Z1 A% ~  g. e8 _
    in      al, 40h
) R: r! p  b9 U& N* K    xor     cx,cx
/ N' C- ~- ]' [: a" n    int     41h
. E. e% @3 b9 l) p% u7 s    xchg    dx, es:[41h*4]
- O  u. E' e( l    xchg    bx, es:[41h*4+2]# }7 W6 C# K/ `% K7 G- k$ \9 Z
    cmp     cl,al
/ q5 ~; |# n* l, C- Y; W    jnz     SoftICE_detected5 l( ]5 D& {. E# _
+ h. x; [3 {( M7 L% Z- r
_________________________________________________________________________* ~5 x: N6 }, P

- ^$ k+ d: u5 S; [- j$ l# l% x) bMethod 077 ^$ r7 U2 S) d3 u/ z
=========
( E1 _$ K* [& P" l5 h% P
1 Y5 H0 h: I& t5 ~Method of detection of the WinICE handler in the int68h (V86)
9 R9 V. c. Z, I1 P) s
& @2 n# y: d, z* C/ ?6 @4 x0 m8 B    mov     ah,43h: z2 r( |" F( h' [9 B2 L, s
    int     68h
: g5 a3 t7 N4 H    cmp     ax,0F386h
( n, v' h8 m7 Q- P2 m    jz      SoftICE_Detected. [' R+ b& Y- E( D: ~1 T
. N- Q) i6 B) N$ |) f- Z. e: B" W
4 ?6 k/ I9 `' W- \' g
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit) F, T/ n& Z2 f) V, p- X
   app like this:, ~/ h& E9 S7 F/ a% R+ j- S' D; z
  @. q. o$ c; w- P
   BPX exec_int if ax==68
# h1 @9 H, e' I' S2 l, N5 }* T9 i   (function called is located at byte ptr [ebp+1Dh] and client eip is
' u! ~8 [$ w& ?: M/ K   located at [ebp+48h] for 32Bit apps)
5 O  H% I" O) h  V3 u__________________________________________________________________________
+ P, r% u1 n/ d4 ~( r0 M6 k. K: G  c: U2 ]! a/ z- r1 A& Y
, I1 e1 {! `- k' }+ V6 g& b! G
Method 08" P# g/ Z' P: e7 E8 t
=========
/ K9 y, A5 }! G; ^3 K* ^" L8 K
' z$ b6 T% |2 \( j8 }- zIt is not a method of detection of SoftICE but a possibility to crash the. T, M. d; N, U, o$ n% C( s; @
system by intercepting int 01h and int 03h and redirecting them to another
% J) F( ~( N" I8 Vroutine.
8 p# F( L. q; z4 C2 @- TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
. R! H: H* z3 p8 i+ H5 bto the new routine to execute (hangs computer...)
$ f, L9 ^' r) c  r% m
0 n/ q: P4 U/ X' C7 G7 }    mov     ah, 25h
( u3 g+ x6 M  a+ O. ?; r4 H  t/ n    mov     al, Int_Number (01h or 03h)" y/ T/ ~# b# m" d) I& h
    mov     dx, offset New_Int_Routine
: w% c; E( `. l3 X& q  R    int     21h9 n# }/ }1 o' C4 F. M
# _3 K& b7 ^2 ?) c- Y8 b
__________________________________________________________________________: j# e- a3 N2 C9 t0 F8 q) {1 f; q1 ~

. C2 x  B1 M/ v8 J3 d! dMethod 098 F! z3 A' p* r
=========- S6 P' O3 {: _9 W

! o8 V; X+ a: K6 V  H* DThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only, p/ X; m4 W& E& j+ i& V) F
performed in ring0 (VxD or a ring3 app using the VxdCall).( A& j& ]6 d) \
The Get_DDB service is used to determine whether or not a VxD is installed
- E0 {* b  g3 Hfor the specified device and returns a Device Description Block (in ecx) for
' f. @7 A7 z2 k# l9 J4 z/ l9 Zthat device if it is installed." |* U- ?2 s- D+ F5 B- u

/ x) K" E7 f* I( w8 Q! f   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: x; y6 W, r8 v0 I" l1 V   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 C, _( E( R9 G( h( I4 `( ^
   VMMCall Get_DDB% `; O* \) R1 g# ~6 n$ t0 n
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
: |9 h" ^+ A. N& V4 y
$ _6 T% x- ^) F& ZNote as well that you can easily detect this method with SoftICE:2 {3 m, c1 i- x2 b
   bpx Get_DDB if ax==0202 || ax==7a5fh2 h6 D4 @* x  z8 ?3 X: p
' `! [$ {, c( v# I  W1 a5 k
__________________________________________________________________________# I8 M" l+ a- B* Z0 t: C
8 a0 a& {# T2 T! e1 m
Method 100 [) s1 ?2 t& p4 x
=========$ ^1 f, a5 `" U/ J! E4 s& `
6 _7 D1 ?$ E& A5 p9 U5 x2 _: T
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with, K# Y( K6 \& }
  SoftICE while the option is enable!!
# v9 v! z+ I' D3 Q$ e- P/ G
) o" w+ K7 [% K8 A6 C8 ^This trick is very efficient:
' t2 g+ E+ K# h% ?by checking the Debug Registers, you can detect if SoftICE is loaded5 s7 j6 i' o( o
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 \2 @" R* y6 k& i% H+ ~8 v; l& qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# n! l; A4 ?* Zvalue (in ring0 only). Values can be manipulated and or changed as well
  B# p! {7 _4 U$ `1 F! B' A(clearing BPMs for instance)
# j$ F2 j3 ]) N: u
) t: S. q5 ~# M) V1 I1 @__________________________________________________________________________, g" L$ F3 u* a& n: ~* H

! I9 k$ t" w2 eMethod 11
4 w0 X  s% m6 S4 g=========% @4 o5 J3 O( W. D4 L7 C

' ~9 O* c  p! O: s) c' cThis method is most known as 'MeltICE' because it has been freely distributed
8 [/ E: @' R# Xvia www.winfiles.com. However it was first used by NuMega people to allow
% x* n. L; Q3 ~" ^9 gSymbol Loader to check if SoftICE was active or not (the code is located
0 r9 M& X0 W: Y  Minside nmtrans.dll).  P) o) ~9 |7 e2 u8 J! l% o
3 q; |! Z* y! o: O% Z8 Q& a+ \
The way it works is very simple:
# Q* d. y2 S. u) M( NIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for3 \8 c% |3 k3 q: N1 N. W
WinNT) with the CreateFileA API.
! J# u* x8 _* \; y4 q1 z1 q9 |6 U
Here is a sample (checking for 'SICE'):) p. ]/ G0 n) }, i0 z

1 u7 J- `8 Q% g- K  A  WBOOL IsSoftIce95Loaded()
; p+ W/ \9 ]* F0 U4 R$ M{  W) t! l0 R2 L% A$ [
   HANDLE hFile;  
, ]& h/ z. y* H8 E, O   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 g: J3 z& a/ T7 M9 p                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 h9 m$ O* U! t+ u3 d4 F* T4 J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
3 j# O% C1 k: l+ B2 P& K$ }) ^9 a   if( hFile != INVALID_HANDLE_VALUE )' H9 H' J; g2 [4 j' G& q
   {7 r) G* R# j( s" v& e! j7 t& J
      CloseHandle(hFile);3 Q) t( z' e. C$ c
      return TRUE;
# v9 n' A6 x5 y   }* f  H: L4 [/ X2 G# I2 x1 d
   return FALSE;
- M( [# |5 q4 \$ G5 F+ j0 K}* C1 J- ~- |$ Q" Q5 e) f+ P+ V$ \1 i
, V1 n. @9 Q$ i* N5 t/ r7 J/ D& `
Although this trick calls the CreateFileA function, don't even expect to be
( s% g( ]9 R7 `( \( M" i7 I( sable to intercept it by installing a IFS hook: it will not work, no way!& p- n2 o, N: s5 d& g& N
In fact, after the call to CreateFileA it will get through VWIN32 0x001F7 g* i6 Q/ A3 e) s  T: L5 q
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 U( P8 m! q' H. b3 E; b& X
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 L3 q8 G. Z9 z' J0 ufield.: m. x2 D, x/ K, {/ o. l+ B
In fact, its purpose is not to load/unload VxDs but only to send a + E  D, e6 H8 f9 `5 S
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, s6 w7 Z+ q* j8 g1 @7 Zto the VxD Control_Dispatch proc (how the hell a shareware soft could try
% @+ ~$ ?* p4 l, B0 nto load/unload a non-dynamically loadable driver such as SoftICE ;-).+ T$ ]% K" F& G8 h. J% ~1 o
If the VxD is loaded, it will always clear eax and the Carry flag to allow; e# `% A+ V" Z0 B' }' `6 j
its handle to be opened and then, will be detected.
; a+ n# d- M1 f2 c5 X/ _: |7 P- D- AYou can check that simply by hooking Winice.exe control proc entry point
6 q9 n2 C3 O1 `0 n5 q3 {' k6 nwhile running MeltICE.
% x- _- _; p: A# f2 I6 ?" G* t' T* V! l" `! T) b* H" j$ s( o7 T

) u! Z2 f; ?+ I  00401067:  push      00402025    ; \\.\SICE
5 v* J. D+ x! _4 p- P3 ]  0040106C:  call      CreateFileA3 F; V( a; x: T( F5 B* A) Z
  00401071:  cmp       eax,-001. \) z8 Q0 W' R/ w2 c
  00401074:  je        004010915 }1 f" S! {1 O) U  W* o( m5 p" ^6 W

- W. i3 [4 y7 s) e  D0 S5 l* m, a# w+ a% x7 c
There could be hundreds of BPX you could use to detect this trick.
/ W0 \$ F. D: ?8 j! m( V1 K-The most classical one is:
6 {1 F, i: y) i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; H" p1 ^1 G( H& t    *(esp-&gt;4+4)=='NTIC'
! n$ C  X; h$ v- d- A, y9 H, V. O$ g# m' Q0 Z/ Y$ H
-The most exotic ones (could be very slooooow :-(
# j# ^; b# p" j4 f7 V  q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 |* h( o% o0 [: V5 ?/ C     ;will break 3 times :-(
4 k$ ^( u6 C5 h7 R2 I& k
6 S, @1 d/ z& E( l7 z9 q-or (a bit) faster:
+ c6 F1 X. U5 {0 {  `& |+ e; R/ c   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 J1 N: o. b6 k) \4 x
! R6 a" D' ^: {' c. ?/ o+ E* ]5 X
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ) S4 {8 I; Q) @- w. Q& E
     ;will break 3 times :-(
! H' K  R( |( a5 g/ U4 J2 ]7 L; K1 @" a' @0 L7 [2 _
-Much faster:& E& q( C$ m3 g8 K
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 [5 F7 y" p% S5 G3 p
$ X+ D( P  l6 m
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; Q# ^0 u" M' ~, l( o, Y+ D7 w. _
function to do the same job:+ b- ~4 r  t; o! v
8 v! K" [) i1 ]- h: i8 Q0 _
   push    00                        ; OF_READ
2 O2 b, C- z0 Z, T9 |4 ]+ y   mov     eax,[00656634]            ; '\\.\SICE',00 x; g. |/ t* X2 C7 ^$ b# L$ r2 ]
   push    eax" B1 t/ A- w% n7 H" s
   call    KERNEL32!_lopen7 y; e1 _4 u, ~3 e
   inc     eax) y- l8 O+ u& V+ s) ~
   jnz     00650589                  ; detected- ~: g7 X/ j! c4 U% i
   push    00                        ; OF_READ
. v: Y) o7 @  h! U# I   mov     eax,[00656638]            ; '\\.\SICE'
, Y) B8 h8 O3 K: n: A   push    eax' R# R6 Q8 i0 x6 ?) Y" H& v7 }
   call    KERNEL32!_lopen* r5 z+ d8 _+ P$ _8 u( b
   inc     eax
( k2 X& _2 A" n$ G. w5 u   jz      006505ae                  ; not detected. E/ s* m$ G% M
3 `& j( L) v  n+ U0 v

8 J/ b7 X& k# y  n! ~, J__________________________________________________________________________: Q- v! Z, v4 _+ A5 O' P. g
& e8 Y- n: ~, X  Y  o  ^
Method 12- c4 [0 n" c8 i0 p/ ^/ J4 n
=========
# z2 v6 W, a, c, C! P8 g) E+ L/ N0 `9 u% K$ \$ ^
This trick is similar to int41h/4fh Debugger installation check (code 05
- {( `3 p/ I% W8 y) a; C&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ N9 F; U+ F/ f; o1 ~! Y" X: [4 i9 Kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
. M  |5 \, E" v4 L  I. _6 k1 U. l6 c0 Z, v1 w# R: {
   push  0000004fh         ; function 4fh
4 W6 t$ q! [2 |$ _' c" }/ Z* n   push  002a002ah         ; high word specifies which VxD (VWIN32)$ ~/ s" Y8 P$ `. O# J7 P) c
                           ; low word specifies which service
" G# I7 \0 R* L                             (VWIN32_Int41Dispatch)
7 e% c. M2 P3 n3 j7 p  j   call  Kernel32!ORD_001  ; VxdCall
6 [9 z! L( |# n& ?! M6 \6 a! C   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ Q8 [' k! [3 V. V9 G: z) V* C   jz    SoftICE_detected
4 a( w- v: g4 g- h) Q# H% K+ ]! o# p: ^6 ~  o+ v
Here again, several ways to detect it:
# R, P: ^6 U, b) I- n
( I) }. ^  |* ?8 M2 }8 u6 C    BPINT 41 if ax==4f
7 _1 d, d. m$ p; R1 Z
% @& s( {* W1 {' R9 V    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 Z% x( \2 M- C2 r

. z; n! a  X3 Q; u( ^& L    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 x- ]  x- p/ H5 @' y5 f- `) U: L' g; Q9 y# Q0 W' \* w
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!% ], s5 x% ]' B0 k- \
. e2 Z6 j2 s1 i8 {
__________________________________________________________________________
2 W/ D) C. v& S* ^% X. q  I; C, X8 x& d3 c& @4 L
Method 13: f8 H. k7 x! O2 c) I: c5 m
=========* }% Y2 v5 w* |: [+ s
! B4 m) C0 `$ n) T, O. n9 L
Not a real method of detection, but a good way to know if SoftICE is
5 Z+ _$ k- F" u( E# W" v6 W% U( Q" Hinstalled on a computer and to locate its installation directory.
' {, R! b' v  J% F- }It is used by few softs which access the following registry keys (usually #2) :
. a% A9 y, W' O" s
1 F, a" L% V. c* O9 _-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ ^' }$ B# f# ^$ ?: C7 }" _\Uninstall\SoftICE( K4 o8 w4 L& Y; a
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
  c1 U& K1 E3 t5 Q5 I-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 m* ?; X- j% |- y: F# t$ f# V\App Paths\Loader32.Exe: b: q) n. ]* N: b" n2 {
5 M8 _! t& b$ V5 c% }" C5 i$ T
, O# m7 n6 d8 z0 T/ q5 @- u' B
Note that some nasty apps could then erase all files from SoftICE directory1 l8 h* N5 I* I2 |0 _& R2 r# v8 q: H
(I faced that once :-(
4 z& j% g4 ]) D6 G4 U# S! |2 O: ~9 j8 F- J
Useful breakpoint to detect it:
2 a) A( M) o( o- m2 R! f, T0 S+ `/ T; I* p' z- q  e
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
; L5 h( J/ A1 d, \) y- n; |
& D  n+ V: Y" ~: o__________________________________________________________________________# r- N3 w! F  P) B* K, N. w
8 `' l  c/ D7 U0 w# x

1 m1 E3 _2 ~+ Y- T" q- M' NMethod 14 6 r# V# u+ n1 d. J
=========: Z6 S$ z2 E4 Z/ s, ]" l5 K
1 r# P3 s! r* o9 G! Q" a
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 u6 l, K. U$ C5 r# o
is to determines whether a debugger is running on your system (ring0 only).8 l4 }) d1 k0 @2 N! `9 Z
& `1 H, C3 I% x1 L5 t3 m3 I
   VMMCall Test_Debug_Installed$ k/ @; C  K. L5 Q$ |* M2 M
   je      not_installed
8 O0 W+ N) N, I
! d( U6 b3 t: {5 z% \4 l/ h+ ~8 z/ CThis service just checks a flag.
7 C( G/ Z9 c7 e3 x! n& N" b</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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