About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) z/ v1 f# B: |! o9 H; d* o+ z<TBODY>3 f; w+ X7 N0 @! G$ F9 o
<TR>( }/ E6 y. R) o! N
<TD><PRE>Method 01 5 w* s2 n9 K- n1 E
=========& m  {# l& `* X; w

: u1 \5 h& J" S! V$ u* [8 FThis method of detection of SoftICE (as well as the following one) is0 v: C7 ]/ S2 w6 L8 z
used by the majority of packers/encryptors found on Internet.
* o/ _8 {) [1 y' H1 H( Q) EIt seeks the signature of BoundsChecker in SoftICE
1 n  t3 _$ Y  u+ }+ z2 l8 M. P$ `9 c3 R
    mov     ebp, 04243484Bh        ; 'BCHK'- R8 a+ w% t8 r! \  V8 y- s  v
    mov     ax, 04h
$ B5 `+ f, _6 e# R  A) ^1 A$ F# V    int     3      
5 h1 O' p3 U( N/ E    cmp     al,4% h$ L# z. D2 \; E, O  U
    jnz     SoftICE_Detected4 G& d+ A0 `/ }( h

9 k6 g+ i! D2 U& O___________________________________________________________________________3 ]6 ]# B* S+ W6 r$ ], O# ?5 `# G
: Q( {/ Q) i2 U" k2 n+ Y
Method 02( z2 m4 k: H/ W4 l/ r
=========- N' K* Z* G+ N' O

& o1 A3 o- D. o0 X& bStill a method very much used (perhaps the most frequent one).  It is used
" R9 h1 X" @3 \) @7 J# l/ l4 yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
1 W: C: M3 z' M( e3 {or execute SoftICE commands...' k# k+ q- `2 w
It is also used to crash SoftICE and to force it to execute any commands
2 E6 I; G6 f( B. k1 J9 T(HBOOT...) :-((  
; |( k& b$ j3 ^) f4 o6 T" m+ k6 n7 ~( A9 y9 c
Here is a quick description:
8 `" o" K  C+ l2 c: j. d0 R+ k& B-AX = 0910h   (Display string in SIce windows)! b- n/ V0 U3 {6 J! R9 s
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
/ Q- l, ~9 s( [- B3 [-AX = 0912h   (Get breakpoint infos)- u6 V1 l/ r6 o' ]
-AX = 0913h   (Set Sice breakpoints)2 M) {6 d. I  i3 \8 w6 R7 V
-AX = 0914h   (Remove SIce breakoints)
' V$ X; H- @% k; M+ O% v4 p
$ l' D! F& g3 v, \Each time you'll meet this trick, you'll see:6 K( e) B. E5 X" H
-SI = 4647h8 @# E7 }" x$ [. a" z- P
-DI = 4A4Dh
. C6 X4 E0 T- \' @Which are the 'magic values' used by SoftIce.
! f6 l! m3 H% K5 nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
- `# K/ e* v0 w, i- Q3 V* _0 u, B1 Q% u* U* c; o
Here is one example from the file "Haspinst.exe" which is the dongle HASP/ |3 z8 p1 f' V+ v, K; I! r5 X! T: H  w
Envelope utility use to protect DOS applications:) N" {  g2 f, u5 q; |2 t, ^
+ W' X" ?5 E8 h! G( {

: y2 Z/ \, @+ X7 e+ T" @; D4C19:0095   MOV    AX,0911  ; execute command.
$ U( u6 Y+ Y* ~% G: {  E. L4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- l' Y+ x( R, c2 \8 T! r1 e
4C19:009A   MOV    SI,4647  ; 1st magic value.
& K1 _; h/ d1 F- S( I  s( X8 m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# x9 s& ]: U3 j6 v4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
: n1 f5 |) y! P, @; p$ \' ^& H; F4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, j% |5 X: u+ P8 [! W4C19:00A4   INC    CX
! e$ W' K: p% `% E/ y4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
0 u7 s" d- t: s: H; M4C19:00A8   JB     0095     ; 6 different commands.
. P- G3 E( x, Z+ L4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 a4 E3 W, z; r4 n, g& N3 t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 f# y! ^! H$ k) f1 D
5 C& f2 s8 c1 `  A& a8 y! TThe program will execute 6 different SIce commands located at ds:dx, which. n( p$ {' r/ [  i
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' }$ D+ N3 c3 O# q, q; L# d2 v7 K& n* O$ e. K0 t" v$ n
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
( ^- N& P* h6 F( r& P( S$ T___________________________________________________________________________
+ A" P- N$ x# a) n. }" {
; M( g; ^6 P  o8 s9 q3 U+ O
- P+ z1 m! V1 b* V8 fMethod 03  U. Q1 V7 U) a9 T- n
=========
& e3 O! J" c$ _% y$ `7 y8 A
0 ~4 N! l; Z, RLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
8 I7 m; g2 P0 N! L  _, v(API Get entry point)1 U3 Y  H% Z4 P( F& C
        
3 U( [# k7 k7 {  ~( j1 x" V. r% p/ H% j' A& y7 N1 T1 l$ R
    xor     di,di* p5 u6 x( {! `- |
    mov     es,di
9 v2 ~% y6 Q" c1 i9 ]+ v9 J    mov     ax, 1684h       6 _5 N2 v0 y6 N! C2 t1 f
    mov     bx, 0202h       ; VxD ID of winice4 F. _# N3 E2 g' Z: G8 g- ]
    int     2Fh4 w6 [6 x2 O/ u/ S: G$ O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ D  s/ ~. N% B, y3 C9 N5 O, J: |    add     ax, di: ]1 b2 a' o2 l; |9 g. {5 @
    test    ax,ax- t3 j& s( R' ]3 Y4 W$ J; O$ x3 C; a
    jnz     SoftICE_Detected
/ W) Z' \% @* H
+ h9 x& o1 W. w2 m# o___________________________________________________________________________
% t. N+ A& h/ C3 t% [" `
# l  z4 y* W8 I$ k* {Method 040 P' b4 D: [* {* e
=========
/ A$ G4 s/ u2 ?2 q3 ?& r
. t% ?4 ?4 W3 a; _( _, V: A% x, t! LMethod identical to the preceding one except that it seeks the ID of SoftICE* h' f- i. E+ K- @4 m" A6 [& i
GFX VxD.
9 e; e, O: K9 R& z/ [& w/ u6 [8 o) l# F* X
    xor     di,di' w  {0 k% ~4 p3 i; C; c, ]) }
    mov     es,di
% ?! y: ^: d& z; v/ o1 j( J    mov     ax, 1684h       $ y& R. b7 ~" `+ y( d8 y' Q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
+ M3 \& k7 t% m  y    int     2fh9 L$ D9 \0 h& E% u' E
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 k. p1 z+ J( D* N6 x% Q    add     ax, di
. f& L0 n. c, m6 g# _$ d) U/ z. v) ^    test    ax,ax
; t# ]5 W( Q$ t7 Z- q8 {    jnz     SoftICE_Detected/ i. Z+ g0 n6 Z; {
* @+ [9 @8 H' ~. ]* m
__________________________________________________________________________# h1 s* B1 N2 z+ G, i. `. q
7 l7 {; f6 X- F
0 V, z' `2 w2 l3 ?4 @+ y
Method 054 l7 E. r: p7 G9 U
=========
; K3 N9 V, E: B2 J. }' s
1 Z# j2 Q( V6 YMethod seeking the 'magic number' 0F386h returned (in ax) by all system
* ?/ U; c. l& Wdebugger. It calls the int 41h, function 4Fh.0 z) I- T& y8 F  \
There are several alternatives.  ) ?2 \9 S5 o# e; w/ b, e5 e

: \; Y3 B& [& r# H) h* V+ ~The following one is the simplest:
* u+ ?6 p4 S2 D! v; }4 C0 Y
( e6 `9 n$ X2 U" p6 [    mov     ax,4fh
- W# J' `4 }8 r' D' q. y. w    int     41h7 y$ g3 Y+ B) P' y- D# a- A
    cmp     ax, 0F3861 |* a6 U6 ^$ z$ g5 L6 _
    jz      SoftICE_detected
( g  f7 q$ @9 f  ^; n+ P! o' V6 {6 z
5 i% _4 i* S2 n( r, I) O
Next method as well as the following one are 2 examples from Stone's
+ D! @1 Y8 n, C" V"stn-wid.zip" (www.cracking.net):& o: f+ F. I8 Z9 b  L# R" h
7 A6 L4 z: q0 D9 {$ T) [
    mov     bx, cs: e0 T. l0 E4 W/ L& A. s
    lea     dx, int41handler2. A7 S' `& t# a' Q2 z
    xchg    dx, es:[41h*4], h* A% l% n4 U' v7 h: W
    xchg    bx, es:[41h*4+2]
- c) G* r( {( A) w  D7 [+ h    mov     ax,4fh! J" Z! o4 r: W( a0 u) T' X
    int     41h
: n0 f& @5 W8 e. e+ `3 W    xchg    dx, es:[41h*4]4 ]  S0 S8 H  g9 V
    xchg    bx, es:[41h*4+2]
' R1 J, J/ `, h: o6 y! F    cmp     ax, 0f386h* o. ]4 p& K5 _" B  ?4 K; `& r
    jz      SoftICE_detected
6 c0 m2 ]9 i( t* \. L) b% N8 p* h/ u' w$ M  ^+ u+ t
int41handler2 PROC
  q( a8 ^, Z. k, {, }    iret9 f4 T& |! B1 ?: W7 w
int41handler2 ENDP4 K/ y) h) A, X( M0 I

! h1 Q9 @* y4 \4 c$ `, q' @
" G( m% J4 O- V* {_________________________________________________________________________
& B8 g1 i" J. {2 \: i; i# S' E: b2 b# m3 {: ?5 U

1 u- l1 F8 Z8 d$ kMethod 06
1 p. H) Y1 u0 Z; R9 N2 m5 w=========; [0 e$ r5 @4 s- _% u7 v! e5 K

* H# e3 _7 o% J: X' w* d
. U) N( [% ~/ j2nd method similar to the preceding one but more difficult to detect:% S6 @$ Z1 J  |* N1 e& c' _
* J/ s' o; u  \5 `7 y. Q. Z) @* W8 d

( g5 G1 Z& Z; yint41handler PROC1 M# @: D) X. p
    mov     cl,al
! |. z' p9 y9 ^) u4 Y/ v    iret
, P% D0 ~, E3 D8 \$ Zint41handler ENDP  G- T" B: e; K9 u
/ s% F) M7 y/ \  x9 {: p% p
, \6 ]- M, e* k( u
    xor     ax,ax+ z* `8 \# A7 ^, \, |4 k" e
    mov     es,ax
  I+ w- t/ o0 Y    mov     bx, cs
% x' `/ e& N- I# Y8 O; o3 w+ r5 f    lea     dx, int41handler
3 W' j7 \/ T! i  F    xchg    dx, es:[41h*4]
/ n" L' N' @* m8 F. `3 a    xchg    bx, es:[41h*4+2]+ J2 k4 C: ?# V; Q+ J6 Q1 o- h
    in      al, 40h
1 B6 `  Y, N' ^" n/ Y; K    xor     cx,cx& i) R" b' A( `! V  M! E' ?- d/ y
    int     41h: L8 X$ o5 k+ w) J
    xchg    dx, es:[41h*4]
$ g8 ~6 y! O. G6 O* N& T6 V    xchg    bx, es:[41h*4+2]9 D, y7 w* m2 I, X' [' ]# |  a6 Q
    cmp     cl,al( z# G$ y# s2 `& H; d7 I
    jnz     SoftICE_detected7 @" u/ K; F7 y9 u1 ^7 M! q

' i0 K# @* ^8 n: ~8 j1 |_________________________________________________________________________
' j$ n; k: _) A) }  }1 p" b( ~, R) j1 w* u9 a
Method 070 Q9 A" T, F  Z* ]! Q2 _: j
=========
* G  u" i0 A9 x) q- D0 x- o) G0 Q* o3 q
Method of detection of the WinICE handler in the int68h (V86)0 z$ ^' n: R8 V0 Z5 B% q' C' n3 q
- G5 K) i2 m7 ]- h8 _
    mov     ah,43h% K6 Y/ [- p) d/ p$ {# [4 @# r, B
    int     68h( V# @8 @. x- d8 s% g
    cmp     ax,0F386h8 d+ g( k# I# M! U8 u* Y
    jz      SoftICE_Detected
1 ?: N+ M2 |/ Z6 o2 Z! o* c6 K- z1 b
7 H" ~, \' R7 r- U; C4 a" N- l2 W' ?( T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
- ^( w# }5 F( E) c+ o   app like this:
" X! h$ z& w" w, N% k  T
3 c' N6 N4 v4 @   BPX exec_int if ax==68
/ t: e  H1 F4 F  D$ j   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 U3 T- i6 |8 W/ t   located at [ebp+48h] for 32Bit apps)8 l$ }7 K6 _5 D1 b& u# H
__________________________________________________________________________
4 ?8 n, `7 D" K; x1 z# a3 ~6 x1 H" N! }# r  T' ?7 [( h9 |6 j
% \- v8 d4 V9 m4 n; B' I6 {8 ~
Method 08& {- z) F: U* N0 @0 T3 e- \
=========) o: K! }- G+ @

/ H) O% m! ~& Y& t0 FIt is not a method of detection of SoftICE but a possibility to crash the
' v- X  Q% K; e$ w1 w0 K1 Osystem by intercepting int 01h and int 03h and redirecting them to another
& E$ L! ?: \% `4 froutine.) k1 b+ ?- ?  I4 x- ^
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, E9 d& [- b% Eto the new routine to execute (hangs computer...)$ L/ x% P6 ?/ N7 \2 R( n  P
+ E7 \* C! O1 W& ^$ W- t! R, ?- G
    mov     ah, 25h
! Q! R9 e, V3 W& `- T7 n    mov     al, Int_Number (01h or 03h)
; N& c" E& ^$ {2 c* ]    mov     dx, offset New_Int_Routine
6 P4 L' t4 M2 B    int     21h
5 a! ~" m* P" i+ u" Y  _9 s) r* i7 e
__________________________________________________________________________  k" K4 S& E; I: c; P; G

) q$ d) o5 |+ j- D: LMethod 09
6 |" A. u9 I9 E" ]=========
. g# }" ], C, ?; {3 G; h$ U6 `& @" Z6 A: I  c  e
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 P, a0 V) I. ?  F
performed in ring0 (VxD or a ring3 app using the VxdCall).$ t; s& u1 ~( v. N  C4 B
The Get_DDB service is used to determine whether or not a VxD is installed* a) [9 g6 u4 n3 G( d- _
for the specified device and returns a Device Description Block (in ecx) for1 o+ r4 g/ J3 `/ U
that device if it is installed.% F# ~; ?- X' \. D3 r
( b7 ^" w; a% b
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID. L$ Z2 v, d! u# |
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)4 e" S+ R" }2 U0 h/ K% K
   VMMCall Get_DDB
+ ~' g4 d9 Q. O$ @& a2 b  |" C   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 i/ Z2 D( Q3 Z" i2 c, D7 j% L! u9 w
Note as well that you can easily detect this method with SoftICE:
8 q% X" ]. ^, r+ n5 N   bpx Get_DDB if ax==0202 || ax==7a5fh; T7 M, L: T* e! q/ R% q# t

6 b1 Z" L, Z' `1 \1 F' ?__________________________________________________________________________/ F! |3 u- e, k9 n

% C; N& C3 X0 dMethod 10/ k8 T) j9 `; `
=========
4 x% R  `+ I& K$ D0 \& b( ?4 n$ g; B. h# {
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with/ K) r% P- J8 X$ c9 E
  SoftICE while the option is enable!!
. p7 j: r9 W$ U5 Y7 {8 \. }7 h1 j: p" S1 R: T/ b2 U
This trick is very efficient:' M! u. @8 x# p
by checking the Debug Registers, you can detect if SoftICE is loaded% y: P' p! X5 H& U9 ?. z
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
' V* _& w$ F, zthere are some memory breakpoints set (dr0 to dr3) simply by reading their
0 a! Y3 F3 ?* S4 Z* dvalue (in ring0 only). Values can be manipulated and or changed as well
0 |' s( Q8 ~- t7 n(clearing BPMs for instance)+ h0 g: J5 c$ c5 S5 d
% f* P( W0 a3 |1 {' p0 S5 a
__________________________________________________________________________
9 P7 M* @, a5 ^* T7 [" Q! M
. m6 H) Q1 c2 c" F, y+ ~Method 11. }6 t" b* I, I. A0 G9 v
=========
2 q+ w/ b" C7 h; [  a! I4 A7 o, w5 o' k+ _
This method is most known as 'MeltICE' because it has been freely distributed
4 [: y& j' A( Y5 H% M8 Ivia www.winfiles.com. However it was first used by NuMega people to allow
3 X0 S/ a( J" L1 H* ]7 N+ wSymbol Loader to check if SoftICE was active or not (the code is located
7 @5 g2 e2 l, g6 oinside nmtrans.dll).( u2 c) [8 p0 R

- L1 B, q$ A! h7 f- J! Y' K& Z4 A) NThe way it works is very simple:
! j+ w  U  L8 l2 O, jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 x! C0 R( M) n  c% u+ `
WinNT) with the CreateFileA API.8 k# A2 t4 U  G4 V0 f  i
. D; O7 q* g) `% ^" U  C% M; v, r
Here is a sample (checking for 'SICE'):+ m) s2 @# \5 `8 F2 n0 j4 \( X: r
# D( u* v' ^1 x  r
BOOL IsSoftIce95Loaded(); s( Q( d  ?- I, z
{# {* g$ K, `6 f0 K
   HANDLE hFile;  
& g9 h& ]0 o5 |/ w+ X3 t5 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* L' D  [! L* B8 G, H- i$ t$ _
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 G$ ~" P: k' ~# y. B% G                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 z# n3 m5 W$ d
   if( hFile != INVALID_HANDLE_VALUE )3 h% G, S8 J7 Z( Z9 g+ L* Q& r
   {
6 F, K% N0 Y& Z4 l$ o# L      CloseHandle(hFile);
" j" s/ x! e3 s( w+ l" I0 h" a2 |: f, l      return TRUE;0 V8 h& B2 j2 S
   }
7 Q9 {/ G8 u2 F: F: L   return FALSE;$ D3 Z9 R+ s/ q3 I/ r4 a4 G# M! J& T
}9 ]: |+ B; l- j
1 b, x3 N3 o5 Y  r
Although this trick calls the CreateFileA function, don't even expect to be
/ t* G# j) D7 L+ \3 r# G, _! vable to intercept it by installing a IFS hook: it will not work, no way!
0 y+ v, O2 f- _5 M1 mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F0 j+ M/ j* j+ v# [6 h5 a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& Y2 T/ V, A. I$ |" Hand then browse the DDB list until it find the VxD and its DDB_Control_Proc
5 N" j& A( V: [: Y5 sfield.
% m3 z/ k, A9 y2 g% o5 J( D7 l+ {5 aIn fact, its purpose is not to load/unload VxDs but only to send a
- {; l1 d8 s3 U6 v2 aW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
# r$ ^% a* d9 `3 G8 kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
- W7 z/ S4 p2 eto load/unload a non-dynamically loadable driver such as SoftICE ;-)./ \# |2 J3 e3 a8 L* a& K  ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow5 G5 c4 Z  A! r% E& o" w
its handle to be opened and then, will be detected.
! I% c7 I; O8 SYou can check that simply by hooking Winice.exe control proc entry point: P) b! N/ Z0 r$ o) l
while running MeltICE.0 |  |9 C! S7 s* s+ R/ o: g5 l
% [5 I& ]; a: y7 u& S$ e) k2 a

: E6 d/ x/ g( H( M6 e  [  00401067:  push      00402025    ; \\.\SICE
5 {7 ?3 `6 j* S. U4 N, b  0040106C:  call      CreateFileA
2 E4 J' i) n: P% k! M/ L  00401071:  cmp       eax,-001
. g1 Y$ b# y' U$ Z( V  00401074:  je        00401091
8 i" u. O5 Y. H2 H' y: O8 G2 [" H9 Y( N! M
& @/ e8 X. {  D* K  W% a" F
There could be hundreds of BPX you could use to detect this trick.5 s6 A4 u  o$ S; k# K3 K2 H" _
-The most classical one is:
- q. M3 v5 ~' Z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% ~& K9 z/ N0 ?    *(esp-&gt;4+4)=='NTIC'
, J% O$ ?# v3 C: h/ ?5 R  F# d1 w/ [+ a" g" I4 b
-The most exotic ones (could be very slooooow :-(5 O- A, N5 Y! w+ s( ?9 n
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. W" Q+ y' ^- A9 |3 N     ;will break 3 times :-(
3 A# A& e2 \+ ~+ c3 A7 I6 _: o, h& U. Q3 s* Y' G3 {- v  M
-or (a bit) faster:
7 w4 n5 `/ ^- T! G7 G. r) G4 g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# ?2 E! L6 V0 D7 V7 E9 u3 u2 `- r- R+ p6 J1 I4 ~4 K0 g4 O  W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 @1 W, K( D* i5 B* p0 X
     ;will break 3 times :-(
0 R; |( g" ^6 {2 X2 u' {2 a! X0 H0 q4 ?- A
-Much faster:
) m( L2 Q$ F7 L1 p, b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', I$ G, {+ E( x

/ t4 |) C* W. d# |  k  V2 c7 `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen/ w, Q/ H9 b& R  J8 X
function to do the same job:
* x' ?. `" N2 p& U
& |9 m" ?$ E$ a   push    00                        ; OF_READ. u( @1 ]7 Q& v9 T5 z9 A8 q
   mov     eax,[00656634]            ; '\\.\SICE',07 x! G8 ]( N# |: [- d* G! o
   push    eax: O4 H0 m4 ?* G6 }
   call    KERNEL32!_lopen: e+ O% F7 m5 {
   inc     eax0 b% E# U* o  k9 h& V3 w+ d) ?/ q
   jnz     00650589                  ; detected
# F: X4 ?  ^9 ^+ p, U5 {; K3 B   push    00                        ; OF_READ
/ x4 m4 D0 H# h" i* n& {9 d/ c+ o   mov     eax,[00656638]            ; '\\.\SICE'
* `- Q& `* ]: y$ p: W4 P   push    eax
) z: i( S1 t5 u; J, b6 {  s* l   call    KERNEL32!_lopen1 U; Y) b' y, b1 {
   inc     eax- Z/ f# b. t) Z3 H) g7 ?
   jz      006505ae                  ; not detected
- }" H* R2 {8 b. _5 |
/ u, x; w9 q/ T9 b$ v% U2 e. b( e$ s: P- Y
__________________________________________________________________________3 v; E/ x  O$ f

- M* [7 g2 t7 }* \Method 121 s% U& g7 s3 w1 W3 ]0 s
=========' }  t) u% r3 U4 H! @- R, y8 j

0 Y( s8 D* I' |' [9 ^7 T' AThis trick is similar to int41h/4fh Debugger installation check (code 05( W  b5 ^- o4 w  Y: T2 v
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
3 b# j+ f  A# b3 \" ?6 las it uses the VxDCall backdoor. This detection was found in Bleem Demo.
1 {7 X1 k  _6 l" M7 J' ?* N6 J( s7 O, N: |: O6 E( ~9 a7 o3 T
   push  0000004fh         ; function 4fh
& r8 d2 l# P" }2 W   push  002a002ah         ; high word specifies which VxD (VWIN32)
% z. m. t- y% r1 Y                           ; low word specifies which service
2 H  J* a+ t6 V- l9 p& z; D                             (VWIN32_Int41Dispatch)
! ^0 [# u: s  M8 T5 m0 u   call  Kernel32!ORD_001  ; VxdCall
" Q* R3 A: |# t; Z2 K   cmp   ax, 0f386h        ; magic number returned by system debuggers
9 q& z! k# @) e: g4 Z! j   jz    SoftICE_detected# }, c  f1 W! w7 M5 d. v; M
2 y6 }0 r1 Y9 B% ?* X0 B9 ?% _6 }5 G
Here again, several ways to detect it:
# o/ g- {) _9 Y; v
0 }8 A# k# P4 g; n3 K# {, r) o    BPINT 41 if ax==4f3 P( z: r1 A0 d: P0 W

: a4 O  R8 p% [( Z! ^    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 b) A, T, i( o
' O  _$ A+ n% h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 t/ T$ h9 P4 h2 N) [) T9 K- u
9 G3 C8 t7 T# G* r# T/ y7 A' Z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; ?! R; V% G! O7 B: H7 A4 l* U- L3 S& _
__________________________________________________________________________
* d" k; N% o4 m8 c4 V+ r& c# p
: M" `- q2 s& R. e# h9 QMethod 13
5 n& y4 T7 D3 b0 b  F=========
4 j0 z$ s# U% y$ g6 U% L& F6 Y& B6 ^0 ~$ n+ t3 _2 z' A) H' v
Not a real method of detection, but a good way to know if SoftICE is2 n; ~3 ?( ]. X3 Q) p
installed on a computer and to locate its installation directory.8 G7 ?" r) b& \+ w
It is used by few softs which access the following registry keys (usually #2) :% E: s, M) ~0 z& W! g( d9 G: p, M

' [& b$ [: u, @" X- l-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ q! }0 t, d& p2 M
\Uninstall\SoftICE
; I7 ~2 U( N6 e-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ o' f1 ~6 P  G0 W) d% r4 e-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ ~' f2 g& v6 b- m& W& u; h- O& r# r
\App Paths\Loader32.Exe
: r; M. j* n+ R: M; H3 ^' i5 n" A! R' j  O  h4 A( m6 o9 T6 l
/ |) {' q$ B) D6 _
Note that some nasty apps could then erase all files from SoftICE directory
0 C) H: Y" v) B' t  z/ o8 c: B5 E+ }! K8 Z(I faced that once :-(
% V, g/ P5 X. v4 l  U7 ~* Q: s5 _
3 |) z$ J+ t" d% C# u( IUseful breakpoint to detect it:
4 Z- n! \/ X9 @' f  Z  u
9 F+ {7 |+ o: ~. P( m- q' a" T     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE': Z) v$ D3 Y/ c2 |. J# j) E
/ p# e" E1 j# g9 @5 z# z. r2 [
__________________________________________________________________________
% n% X  m% J, u. v: d( C) G& F/ G* I( |3 m- \4 T
) E; M. o# T* \- R
Method 14
$ W* B7 o1 h2 `# H9 ?=========* q0 D+ g( u0 e; Q
, N7 E: r& G  x6 U3 c" Q2 c# o$ L
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 Z5 L; i9 Z: O# S1 G* G
is to determines whether a debugger is running on your system (ring0 only).
; R- f# }" P/ V# R  O; \
( k: ^' m& u) @& E   VMMCall Test_Debug_Installed
, A7 ~8 q! o2 u' Q+ k( ~. d   je      not_installed
6 C# E3 k6 [0 m/ ~" ?; U
9 \4 V* P- S* h3 j" o4 w; h+ vThis service just checks a flag.' V% m# M/ w/ p6 a( ~
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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