About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>) z/ w# i5 Z8 _! q. ]
<TBODY>
# n. D' W5 G& Y5 g4 F9 z<TR>7 W0 B; X: ]+ _! O+ R+ Y3 `
<TD><PRE>Method 01 , A: f+ q5 w1 d- G, r6 e% I
=========
$ h) r5 V" H, [4 N9 y
) m; T4 ^) P# M: ~, _2 VThis method of detection of SoftICE (as well as the following one) is
7 x; W/ |0 Z* n- o5 Q# P  Uused by the majority of packers/encryptors found on Internet.
7 B& }* [$ C; |) w* D6 L9 ^It seeks the signature of BoundsChecker in SoftICE8 A# h9 j) ?4 ?

5 `4 E( o% M) e: T" C# y3 q% j    mov     ebp, 04243484Bh        ; 'BCHK'
) }* c5 Q8 Z2 f1 U3 K4 ?& h    mov     ax, 04h+ p7 O5 v( e! a3 Y
    int     3       / p2 T0 @% x# E. u& O, n) ]* @' f
    cmp     al,4
8 z2 s# a$ \& N    jnz     SoftICE_Detected1 F/ i/ t) O* z* R

- {" r  z" R3 Q: s___________________________________________________________________________9 f5 f9 G2 g0 d" f( W
" q; h7 M7 u, G4 a. b. ]
Method 02
* o6 \# B! E4 f+ e2 s1 ~' I8 R=========  Q0 r: G4 F* G7 L: M7 L

& {+ J2 `3 g" WStill a method very much used (perhaps the most frequent one).  It is used
  ^. R- l: i' {0 O* Zto get SoftICE 'Back Door commands' which gives infos on Breakpoints," W. s. C+ N% I8 c
or execute SoftICE commands...( N2 H/ b: G: C2 n
It is also used to crash SoftICE and to force it to execute any commands+ z& l7 s0 @0 s' u( w
(HBOOT...) :-((  1 F7 B$ m& v% d9 H; j. R

4 l- h: ^9 d7 `4 l1 HHere is a quick description:
0 e' t8 a- C* k7 i. H-AX = 0910h   (Display string in SIce windows)4 r/ }6 [; ?; {
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 u, m. \' J2 E6 j+ M' O-AX = 0912h   (Get breakpoint infos)1 ?  r0 ]" @  X2 Y2 h/ {
-AX = 0913h   (Set Sice breakpoints)! g* V1 C4 H( M! I
-AX = 0914h   (Remove SIce breakoints)+ L0 t$ X( Q7 R7 S

+ {7 B8 o! {, F  P( s6 q; sEach time you'll meet this trick, you'll see:, @  j+ C, j$ g, `  F! R- l
-SI = 4647h! y  K+ L4 v. V; g
-DI = 4A4Dh
+ {1 C- B! p# j. T, ?  p. j. I- f: jWhich are the 'magic values' used by SoftIce.8 d) z, Y7 C5 O, p( R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.% x7 i0 M0 j# z* `6 O
1 ]$ @* y3 ^! ], Q; R% p( J
Here is one example from the file "Haspinst.exe" which is the dongle HASP( L$ T" J2 P5 N3 E% T: x0 @
Envelope utility use to protect DOS applications:
) F9 R" [0 e. E6 b* R* l4 F
" }- m: ~0 ]. a1 D: }, g
+ ]  P: h  Y* P! F+ A4C19:0095   MOV    AX,0911  ; execute command.
& J. a  ^  q& E4 O1 A4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 @+ w  Y! o1 U# E4 T) n4C19:009A   MOV    SI,4647  ; 1st magic value.5 {) k. W+ q6 y8 _/ H' N, h
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
  H2 u4 _* c# M  ]' L1 }4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* s1 W2 G5 M( P  t& M5 q# k7 c
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 r* _1 k+ t- @$ H6 b! K) e4C19:00A4   INC    CX
; s; _) [6 T, O& S9 j- Z# L4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 ]7 d6 c% i% j6 }. H4C19:00A8   JB     0095     ; 6 different commands./ D0 g: X# ~# l3 r+ b
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.# C, U/ O3 \+ {2 f1 S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)( C" r( ~# D/ Y
2 s8 V4 @; k9 n5 o. s, x# ?8 _3 ~! x
The program will execute 6 different SIce commands located at ds:dx, which
! }; j2 X  ~$ _3 xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 {3 w. F  b! p9 ~
% M% d, `$ J1 [- o" i# _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded., \/ y' I4 k1 l5 g% d- r1 C
___________________________________________________________________________' k" w+ p4 T) Q4 k
% J7 f- u8 B$ y/ h1 w$ z0 X
) P' x9 t$ H* G1 Z4 k, s' k
Method 03
4 a; t1 b+ R$ h/ E: ^. _* t( r=========" k4 a4 P. S5 X8 k* @; U$ h& Z! V
" g3 f5 J; f  y# r" c
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ J$ T; \9 k" y! r: T: S5 R
(API Get entry point)0 z" C8 v, x/ u( W
        / K; @& P* p2 |7 `% N4 ^" C# A

3 `1 s- B/ T7 q( ^/ b$ z) f* }% m    xor     di,di: k' W% W" p& e# X
    mov     es,di7 {2 G: ?6 q' I* |( d! C3 k
    mov     ax, 1684h       4 F1 J- [$ [8 z! A4 F; h
    mov     bx, 0202h       ; VxD ID of winice
! y/ x0 m3 l2 J( f/ k& H5 Q/ a    int     2Fh
# y" c1 ~) U; R3 ]+ B    mov     ax, es          ; ES:DI -&gt; VxD API entry point" i* ~6 ?& x) A+ L
    add     ax, di( Y' q, k+ k: n  s2 f
    test    ax,ax
# X& j- g( A; p    jnz     SoftICE_Detected
5 ?# Z, i" F" o. s5 a1 D% P$ Z- V2 z% u5 Z8 ~# o% y
___________________________________________________________________________
. J/ ]$ z4 u: O( K4 ]& r( o8 W/ X% W& f. P
Method 04
" x4 a: S, f: a( \=========
% R+ E7 K; G$ B& M8 k! H% D( t5 ?, q0 ~- |! M
Method identical to the preceding one except that it seeks the ID of SoftICE
4 `; t" l! }8 i6 `( B) r! SGFX VxD.7 L% u: c# e* W- `' A* c3 G1 o& Y

) D0 q1 o; Q$ L/ h  h    xor     di,di5 J: E7 ]0 E* J
    mov     es,di
" P! W' n8 a/ S" e. w    mov     ax, 1684h      
, Q- j# X& K3 p* j4 n- D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, F2 c" N$ b9 i: K& ]- ^8 Y    int     2fh' B* r, s/ m! {/ ~  Z1 u% _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ T9 D- Z' _2 [6 i) ~8 ^/ [    add     ax, di
$ `0 C5 |3 O. t0 [    test    ax,ax
5 Z, w' K9 k- I  ]' \2 q! X    jnz     SoftICE_Detected
6 P) S& a  }9 Y$ o+ T& m1 w5 y" H2 o8 |3 w4 f2 Y+ ~7 H
__________________________________________________________________________
9 j# v7 C; W, K( J, X  M/ j/ B0 V6 V- S

; q, F0 E1 I1 p. I/ lMethod 05
; p, e6 D7 X; K/ Y- p  u9 r=========% x( |8 D3 ~, O
" \" k1 @5 P; z4 T4 R
Method seeking the 'magic number' 0F386h returned (in ax) by all system
3 j. r  l4 E# f# O/ zdebugger. It calls the int 41h, function 4Fh.
2 a% B! @. g" ]0 pThere are several alternatives.  : e! m/ t* U  G+ c$ q
1 q6 F6 J( x* w
The following one is the simplest:
) t' u, h+ ~) c- j  T( L- D1 X3 f" S' z# r- q( m6 I( Z
    mov     ax,4fh" q. c) w3 t# J! z* u
    int     41h# x% z4 n* c- m# i: m$ ]
    cmp     ax, 0F386  _/ ^+ z+ ]1 n- O3 z* E
    jz      SoftICE_detected
7 \( e) i7 A+ a4 N& w8 P" I1 e, g1 R4 R* g  Q% Z

. X  n) p5 }* lNext method as well as the following one are 2 examples from Stone's
% v  L" F! G% b& X( F! ?- Q, L/ u/ i"stn-wid.zip" (www.cracking.net):
: z9 L: m7 E. v9 b$ C2 X
. p5 s6 _! @6 F9 O- m0 ]+ V# L4 C( c3 D    mov     bx, cs7 G$ x: F9 F  _, n
    lea     dx, int41handler2
- R+ i$ X5 c6 c& m    xchg    dx, es:[41h*4]
- h" b1 C. x% W% W) Y; [' k: T    xchg    bx, es:[41h*4+2]
2 ]9 f* {+ U$ ?5 q- A0 m$ g3 ?    mov     ax,4fh7 g' p- D4 Q& Y( A, y4 B
    int     41h
2 q! p* O6 T- W: G    xchg    dx, es:[41h*4]7 I- A+ ~; i+ Z. n
    xchg    bx, es:[41h*4+2]
9 i: o: N2 S+ K    cmp     ax, 0f386h
. L. s% S$ \0 p. ?  S2 a9 j    jz      SoftICE_detected9 d, S1 R0 V& U; x. s: V8 D( a  [- D
4 w9 W4 s7 c6 o( S
int41handler2 PROC# Z7 S% ^: j7 }3 ^
    iret
: k) C9 \# F3 }. I+ e; Kint41handler2 ENDP
* ^* z# K( u3 D7 ~- m3 V) h6 H. ^% J& X0 [0 p/ l5 P( }

. |4 N# }* `' A$ R_________________________________________________________________________
; i( t: t; T4 T" ?, ?' N" o
4 _. o6 \6 h4 W+ P
2 k$ s+ l0 q- o0 t' V" |% yMethod 06
$ d6 e6 H7 z1 |+ w8 t6 U=========
7 Z0 t7 p+ j9 R$ K9 a  h, k: \& b* R8 U7 z* l. j% O9 O
) p: c$ l* [0 X6 M) g# g; P; t+ F
2nd method similar to the preceding one but more difficult to detect:
4 }8 C" w7 Y: _; u4 q! E( E2 H2 K7 q  i& j( O7 f
8 U0 B" {  V% \, }# j
int41handler PROC' ]1 L% ~8 g4 @. {
    mov     cl,al& L* f" p" E1 F. l( I$ v; [
    iret3 h7 j7 x0 ~7 Y) z5 a; d
int41handler ENDP2 h( {/ x2 r2 O8 h3 W+ @
* e% J; P7 v. l! S
/ A) u# F+ j5 e% z2 j. g% B
    xor     ax,ax
4 F% a3 S4 Q( H" p& |- c+ F    mov     es,ax* d: N" b$ M! G" G
    mov     bx, cs
. o: S2 D4 ]" i2 p    lea     dx, int41handler
# ]; I1 L- U3 ]3 h" T; ~1 y: p    xchg    dx, es:[41h*4]' J( i+ f% Z; ~( y) ?7 l
    xchg    bx, es:[41h*4+2]4 ~' E* }; F2 D; ?% W
    in      al, 40h5 j5 `4 w# m8 ^  C6 `4 W. ?: c
    xor     cx,cx
. j: O5 C" ~# j# J6 O    int     41h
7 ?" e8 B9 a5 l5 P    xchg    dx, es:[41h*4]1 N# O7 X' q  X2 v9 T
    xchg    bx, es:[41h*4+2]
/ X" A7 U! C) _% F; p    cmp     cl,al$ k( G& D4 o: i- f/ b& o/ _
    jnz     SoftICE_detected
$ m, u$ Q2 b, y
4 \; K8 T* h. g4 G_________________________________________________________________________
# c. U  o& }0 I( O' q
8 T6 F/ P& ]: Z. T+ bMethod 074 C& S5 r1 b% |4 ?
=========7 m- z" {+ g  X9 _

& V, G, H  l; \+ r% D- P; xMethod of detection of the WinICE handler in the int68h (V86)  t/ u0 U/ W* b) r

9 H9 \  P4 \* ?0 k7 f    mov     ah,43h$ C: A* X7 r2 y0 W/ Z6 a, T
    int     68h6 I5 a- L& ^" `1 `* ]4 S2 o
    cmp     ax,0F386h* U' _) K! B0 `6 ?1 r2 m( o
    jz      SoftICE_Detected
' a& ~, G( f8 j1 C1 q7 M. h- w+ w1 g+ @6 n  j- I
0 J4 D* u, `) G* a+ W
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ [/ {! ?* J. y
   app like this:
4 k$ a  b( P) [2 K5 a. ?7 q: A/ c; O: Y2 D% {" x
   BPX exec_int if ax==68
- H$ G7 M6 G$ |2 O   (function called is located at byte ptr [ebp+1Dh] and client eip is
+ o8 _# u( p8 p) m9 x1 t0 }$ v   located at [ebp+48h] for 32Bit apps)
2 T$ J; V# T8 J2 d% n2 I4 T__________________________________________________________________________
0 L0 ~/ y* j3 D" J& u- j3 V: [3 Q+ |% J! I9 _4 y

. I) M3 J) L$ r( N' B3 m. H! ~Method 08
: B: g, H& q. z7 X, o  V. H  Q+ A. T=========4 ^% k$ c1 E: \: s: ^9 k

7 ^* |# l! a6 [0 p! _, CIt is not a method of detection of SoftICE but a possibility to crash the3 n" q$ @6 ]; H+ [) ?+ _
system by intercepting int 01h and int 03h and redirecting them to another9 e2 r8 F4 O. G2 h
routine.: U! T! n. Q/ d4 x3 }
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points: r* t5 }# M2 t/ w6 y, l( X" n
to the new routine to execute (hangs computer...)! S! D3 q+ Y% d" |4 Q8 D: D0 X1 z
- |. f- V6 m# ]2 s) B
    mov     ah, 25h6 j) `6 P9 N' ~
    mov     al, Int_Number (01h or 03h)6 @5 }$ J. r$ ]1 x- x& o
    mov     dx, offset New_Int_Routine
, R3 k: v* @' @    int     21h% [$ u: _7 U; }! p' [# c
- Q, J% C2 D2 }$ k9 N' I
__________________________________________________________________________
' r) W. j) v8 `+ C" r" L/ b
( N, i2 L' [6 JMethod 09/ r4 t. |! _0 S. F- q) \5 a- R8 F5 T
=========& K1 N5 H1 f; W$ A) n7 ~

, d% Z' T$ r7 `& ?This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: a- {. y5 u. pperformed in ring0 (VxD or a ring3 app using the VxdCall).
6 x$ |: V' f' N$ h* V8 gThe Get_DDB service is used to determine whether or not a VxD is installed
2 ^5 O% s: b5 r7 C6 E2 lfor the specified device and returns a Device Description Block (in ecx) for
9 X$ P9 ^7 s" ]! d3 v, O9 C* ]# g% nthat device if it is installed.
: t- q; e$ o# \- k9 Z* A9 ?4 M$ ?# Z9 V0 f# g) M4 s5 I8 }) [! y
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 A) B- z) ~. {# {
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); T: T" y1 j! E$ v* R: Y6 Y8 V. i
   VMMCall Get_DDB
1 X5 _3 G- _/ Z$ C' ~0 H  @   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
2 ]9 h. f( S5 M; ?5 P( L: I9 U8 G1 X: v6 d" b
Note as well that you can easily detect this method with SoftICE:' f3 K$ s+ ]5 H) `$ [5 U: p* ^
   bpx Get_DDB if ax==0202 || ax==7a5fh# H- k2 z" t. r! [% Q- y

% j6 f) |% ~6 j: Z__________________________________________________________________________+ T! V$ g$ X- v9 H' ^! z1 a
4 T5 P( o. R6 i. ^  e% Z
Method 10' [) P3 G& {7 I  q9 M. \
=========
/ s7 d3 [% B0 C  |
  Q+ v, a2 X; [=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: d/ G4 B  }  d+ C- V
  SoftICE while the option is enable!!- S# m% Q+ i% l6 t
8 z4 \; N7 L, {) o  ~# u+ E
This trick is very efficient:; U& A# p3 ~: h2 {7 Q; D
by checking the Debug Registers, you can detect if SoftICE is loaded' |# F1 t) w8 [
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
9 P. l7 }- r2 V) X$ D3 W, b" [there are some memory breakpoints set (dr0 to dr3) simply by reading their. B7 H& r* Y0 g6 u( o) R
value (in ring0 only). Values can be manipulated and or changed as well! A0 Y* H6 \$ g* K
(clearing BPMs for instance)* Z& \# |' m, e$ m
' {7 t6 D$ s$ W2 H/ v
__________________________________________________________________________
$ J7 n) B1 _6 [! Z3 Z$ o
+ `& j$ R  w1 D( g1 D4 F  XMethod 11
, {# w1 h0 ^/ g=========- u0 i- F* @/ a

+ A4 J5 M  _6 j9 `& p+ gThis method is most known as 'MeltICE' because it has been freely distributed
, r- X! [  i# k6 {( Q$ g' dvia www.winfiles.com. However it was first used by NuMega people to allow6 z( s7 J0 a" J) W0 e. W! T* m' s
Symbol Loader to check if SoftICE was active or not (the code is located
$ d* s0 @3 A& g; X# [inside nmtrans.dll).) G& G8 |3 D. t0 S

2 Z7 @/ q3 ~( rThe way it works is very simple:
3 a/ `1 d# O+ l0 t! p; zIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  f3 ~* y6 i8 R* {2 g$ C8 `/ ZWinNT) with the CreateFileA API.
6 S6 E- Y2 V, U7 Y" h% I! ]+ W
( `0 e4 v2 ?+ w% @Here is a sample (checking for 'SICE'):* u7 ]( n  v( ^+ {

, E9 E' c8 a8 }0 V3 ~" G% P  IBOOL IsSoftIce95Loaded()
8 R1 k5 i% n- f{7 @& K- E( L6 O
   HANDLE hFile;  
! c3 w- i% T' M2 X6 Y. k3 w   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) ?% d( @  R$ Y4 |: G, `/ l- s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,, R( O4 I) S. s. @, e$ V: y
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
1 E/ h* D9 s+ e+ e   if( hFile != INVALID_HANDLE_VALUE )& t( Y8 n( s0 P
   {$ ]* T2 X9 G; P, P8 }5 N
      CloseHandle(hFile);6 U6 v$ I" V2 M6 Y- L7 i
      return TRUE;5 \. b$ [( z0 c* ?+ u: Y1 b
   }
  U1 W8 A& |- z7 }2 R   return FALSE;+ q' j, M5 K  J8 v- T
}
9 S$ ]0 N( M4 P+ N' d/ f" K( |6 U0 h! x9 s0 N6 w3 n
Although this trick calls the CreateFileA function, don't even expect to be
: U1 U- @* l; l7 jable to intercept it by installing a IFS hook: it will not work, no way!2 l4 I- K' W2 R% R% b. y! T
In fact, after the call to CreateFileA it will get through VWIN32 0x001F3 ?8 b* T+ N+ r6 R& Y" \
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 `7 f8 A2 }8 w% Z$ j* ^
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 }" E, D8 ~" k7 k% Q) G5 n$ @field.' K! W5 Q  O, ]8 S2 }) B( ~  q
In fact, its purpose is not to load/unload VxDs but only to send a : E% D' O8 ~2 p9 g/ G8 u  j* d
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* z% s. Q/ B" V. Q4 S0 Lto the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ `& G6 f# e/ s" l+ ]  c) E. v; Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).* B5 x3 h, E+ ~" b8 K
If the VxD is loaded, it will always clear eax and the Carry flag to allow. U5 x* Y! z# U3 P7 T  j8 Y1 e
its handle to be opened and then, will be detected.& R) N4 x8 r. n; ^+ U% l, B7 b
You can check that simply by hooking Winice.exe control proc entry point. h9 @0 G8 d# P+ F5 {) D% D, w
while running MeltICE.: H, t, |" m/ m; }# E
% R- D! P7 w( X$ T( u8 R/ i2 C

, j3 C/ b# z2 |: O. \. q  00401067:  push      00402025    ; \\.\SICE
0 ~& N3 l! @9 N9 }. P. ]: S  0040106C:  call      CreateFileA
& Y2 e0 p* S! I  00401071:  cmp       eax,-001: a, p+ f0 N4 {2 ?* g
  00401074:  je        004010914 e- l0 t) X+ w9 r1 c* B0 O& H! O& c# R

- r1 a* R" v* W# |2 _+ n/ C# U( f- k* w. E
There could be hundreds of BPX you could use to detect this trick.' X1 ^! {/ ^. K
-The most classical one is:2 Y; G' I) A/ a4 I! q2 L7 I4 ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( @) F) l. K1 e
    *(esp-&gt;4+4)=='NTIC'
& M. W! q' q! w1 j9 D/ O5 e3 l
9 \( R0 F. O3 v+ S* m2 h3 j( m-The most exotic ones (could be very slooooow :-(
# |5 T) l$ \- H5 E+ P   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' [) Z7 H4 O0 e) H; `5 B. P9 K$ E     ;will break 3 times :-(" N2 ?0 T* ~0 G( V, K

( M, _1 W5 \7 U1 ]8 \$ C! N; I6 }-or (a bit) faster: 0 }  C& q9 G  z" r! B
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# ^- Y% }. Y' }1 O; u4 _1 b7 a, R
4 J; [) k- D. c; L, K   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  / O( w, E" S& M
     ;will break 3 times :-(1 X! u9 {) c8 W) o5 q0 o

; N+ n5 s* a3 `& i& Y% }" m-Much faster:
7 |% C2 x1 @/ o2 R$ _1 f5 h   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ a, f3 y; J1 v8 m8 `( ~4 ~
% z. ]; o* c/ ]  k
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* O: {2 c- ^! O& |: N1 kfunction to do the same job:
( F7 {- z. t6 @9 P: N& k  Y
$ ]! o+ k( [0 O   push    00                        ; OF_READ' F9 W* |) C4 \! K; k
   mov     eax,[00656634]            ; '\\.\SICE',0
8 S; r8 Q3 a% {) u( g# y   push    eax
* O$ K8 B% N: m   call    KERNEL32!_lopen
( J8 @- w* }0 |3 B  R: I   inc     eax2 M0 D) I; l( u) ~* k9 o5 P
   jnz     00650589                  ; detected
# B: n% Z; c- w  a3 Z   push    00                        ; OF_READ
( [) O; ^: E/ i  a% Y1 i8 T   mov     eax,[00656638]            ; '\\.\SICE'$ c$ S5 l5 {: n
   push    eax: H6 x$ P9 \7 r3 z$ @; O( f; Q. u' a
   call    KERNEL32!_lopen
8 A; p. P5 G8 X& t5 Z: L   inc     eax6 s- {: n" r  H  e
   jz      006505ae                  ; not detected& S, C1 Q( F' j5 N4 i1 o$ R4 s
- @$ S- b& ^) Q6 ?% M$ w2 l
7 l9 A! a' n" j: x: i+ v& W2 z
__________________________________________________________________________
$ ~" ]: y7 v7 S* q2 m7 e+ V
, P( Q4 i# Z4 H0 L/ e  NMethod 12
. @4 `( W( ~0 W=========0 u" i, ~1 d) j' T8 y. O
" c  b2 R" ~& n, E
This trick is similar to int41h/4fh Debugger installation check (code 05
3 C, z. {$ S; J&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( x( q* \8 |- @" Las it uses the VxDCall backdoor. This detection was found in Bleem Demo.: p& _  M+ e! T
! y* o5 F9 L% C2 W  H  [
   push  0000004fh         ; function 4fh
2 T0 c4 t7 J1 p2 t% T/ }# K   push  002a002ah         ; high word specifies which VxD (VWIN32)7 X% H7 E5 x- W* X2 H
                           ; low word specifies which service# V9 ~1 j5 \6 ^9 L# ?& D
                             (VWIN32_Int41Dispatch)
; t/ y- y4 C$ p0 u, z& a   call  Kernel32!ORD_001  ; VxdCall; r* a- s3 X% X% K6 X
   cmp   ax, 0f386h        ; magic number returned by system debuggers) B, f( y5 b5 Y( D4 N# G
   jz    SoftICE_detected
& C+ D: u- J" I- @+ |  B) S5 d9 p$ e
# z. s  y( _# `$ `: uHere again, several ways to detect it:
& E7 b' e$ ]; }0 e$ R' b# a0 r7 Y
    BPINT 41 if ax==4f
1 Y$ E, n& B+ N; }4 M4 W2 F# ?* {5 L- X; [0 d' f" S% v4 o! B* n8 e; J$ H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 o" ?' v" j' o9 j  W2 T3 I! q/ y9 ~3 A4 o% y4 [6 A6 D" T- ^  o7 L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 Y$ o; d( \! {& P9 ?
4 l; b* u9 R+ \    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
, }$ z4 Y* N& o  p8 a/ f/ H" X" ?6 C" P
__________________________________________________________________________
8 h: y+ J/ @. K& o. M- j* D8 b3 d
7 t5 }+ y) m2 S, }) ]Method 131 f1 ]* S- n4 b
=========; |& I/ f+ }) K
' N6 n$ d1 j- [) y# G
Not a real method of detection, but a good way to know if SoftICE is
: Q8 k& Y  J5 |/ xinstalled on a computer and to locate its installation directory.
! y, u5 o" b! x' r$ M, K! vIt is used by few softs which access the following registry keys (usually #2) :
' t8 C- I1 q9 c4 h3 R/ C
$ _- ~* U- a) x9 g-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 V; x4 T( v! ?4 J8 `; S\Uninstall\SoftICE; Z# {* n+ s6 t& ]3 q/ u2 f3 g
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
$ C' t7 A( C/ U& p/ \-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) ?$ ]+ l0 |1 \1 Y& w1 y# u\App Paths\Loader32.Exe
, b  ^; E3 ]+ j) ]1 A. S9 d$ g' z) O  Y2 r" G
& P" P' r- N3 D& z$ D' y
Note that some nasty apps could then erase all files from SoftICE directory3 w/ Y1 P  w7 K& q% q
(I faced that once :-(( ?* G& g( s- t4 S) u# }4 f

- u0 e3 `4 y  h- @* b0 r! PUseful breakpoint to detect it:
4 z, [* M3 o1 Y7 l% B# j5 }# z7 J0 o; M  h
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 ]% x- g  E4 o6 K' I7 ]
5 X8 C4 L" n2 r: u( J3 h- s
__________________________________________________________________________' y0 e+ E( y3 c% j
4 |! x1 g: [6 i/ G+ O# f
! E5 l: `2 [7 \5 _4 \
Method 14
3 X! J5 S6 k. @=========
& Q7 {' U, g* X! V. X) N( i! e7 M6 J6 F" z% B/ \2 D
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
# ~9 {+ H0 [% g# T9 s. Ois to determines whether a debugger is running on your system (ring0 only).
1 _5 x0 v4 x8 X
6 S8 t# E8 [8 P- {+ q4 C' Z   VMMCall Test_Debug_Installed; {( k1 t( d% |& `# [4 [% ]. h6 a, P* d
   je      not_installed
/ {# Y1 h6 |/ K5 Z3 s7 g! _
5 D) _/ t- w7 V1 HThis service just checks a flag.
8 A# S" [0 T; O. g. n</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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