About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>& ]4 P+ R7 m1 X0 A" \0 @3 g
<TBODY>1 a+ g; ]8 t' b, [( C$ c- M9 s
<TR># E! p* W" r( C
<TD><PRE>Method 01 ; v! b' H; r! z. v
=========& U* g/ h: ~2 ^* t. J

  A8 p- \. X9 @# h2 P, N$ zThis method of detection of SoftICE (as well as the following one) is
5 _! T# @0 n# Y. W) Uused by the majority of packers/encryptors found on Internet.
% z) t$ \" P+ o1 X" ]It seeks the signature of BoundsChecker in SoftICE* x5 a$ d* h+ }) ]1 X0 w4 l. b
. j- O1 _& D+ I5 C8 r6 T
    mov     ebp, 04243484Bh        ; 'BCHK'/ z7 i* s7 P& ]7 D3 `
    mov     ax, 04h
  a6 J2 L( e/ J' L& E    int     3       , n/ W7 y% d7 V) @9 \/ \4 ]6 t
    cmp     al,4% g( j+ ?' \; O$ ^- D" l% R, ^+ h
    jnz     SoftICE_Detected
/ e9 b4 Y# w2 k  F: i, _  n0 @( T5 V: m2 O" @: p0 a
___________________________________________________________________________$ T# q3 B+ R2 x& F2 _
. F  b. `6 }$ h" y
Method 02" g3 a& Y4 P9 v
=========# t8 Y. x( L, c8 k) ~4 b

, J+ a' h3 n2 S/ ?) `' lStill a method very much used (perhaps the most frequent one).  It is used( h7 n& @& \: R5 u$ t, ^& v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,, S: u; J. {7 t" x- K9 ~
or execute SoftICE commands..., _1 X, w" @$ X5 g0 I( R) P
It is also used to crash SoftICE and to force it to execute any commands
8 r4 Y' Y; X7 R# P) M(HBOOT...) :-((  6 ~. ^4 q0 P8 `) \3 ]
; m* `  T# z3 ?" ?6 S& T9 h
Here is a quick description:1 w3 m0 T3 C8 K/ E8 u% l* R4 D# `
-AX = 0910h   (Display string in SIce windows)
3 |# W; ?) I6 ?0 f" n& g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
' C8 s" @2 |' F# S-AX = 0912h   (Get breakpoint infos)  ~+ S5 M7 @8 l, x6 S
-AX = 0913h   (Set Sice breakpoints)
8 i! F3 _% w5 Y% I9 l; _5 k0 x-AX = 0914h   (Remove SIce breakoints)
8 J, {: w4 z! V6 _( d  C* x3 B1 I$ o& ?- `3 Z1 g
Each time you'll meet this trick, you'll see:/ O6 y% N0 g: H  Q! S
-SI = 4647h
0 w: |" P* {0 E-DI = 4A4Dh
5 d- M) A+ j% xWhich are the 'magic values' used by SoftIce.% @( H9 d, m+ m4 k
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' h2 i! P1 ~, i6 `* K& t
% d8 N( y6 R% {" s& IHere is one example from the file "Haspinst.exe" which is the dongle HASP& G; W) L& y) ]. H/ x2 Z6 Z4 a
Envelope utility use to protect DOS applications:# u+ d+ ~! Y4 U9 ?& Q* s1 l
8 Q$ `' K# F4 P( F' y+ P" s
% D# `9 m4 P. P+ H, F5 V: _
4C19:0095   MOV    AX,0911  ; execute command.. j" X* O; C  `) k  o2 v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" o" x* _* H4 X$ |$ X" U1 y; _4C19:009A   MOV    SI,4647  ; 1st magic value.
9 f" {2 u4 x1 r9 h/ G# H* D4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 G/ F, ?# M+ ~: k* N% V; C4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)1 O$ _3 d* F# d. c! e- t
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ O! }& k+ L- A& z  T4C19:00A4   INC    CX
5 G' h2 j/ ~/ s+ G+ P* C4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- ^6 W. g) k; c4C19:00A8   JB     0095     ; 6 different commands.: A& |" K) ?: i
4C19:00AA   JMP    0002     ; Bad_Guy jmp back., `3 g: \6 P5 G9 }+ z! v; u. g
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ Y9 X/ l/ \& T( d: O4 H
6 `1 X& ^$ E7 A, O  \The program will execute 6 different SIce commands located at ds:dx, which
9 `0 R1 }3 \& oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.# e$ O4 y9 u  Z4 V
; u3 e& b$ K7 S; p3 x- f
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded." ]( E& M& ~, [) X3 A2 s9 Q  S
___________________________________________________________________________5 O1 \+ D  @! X! w  ~; z
/ m2 l; M8 {7 S# b8 t1 ?

4 H# E: K$ P" S/ S& VMethod 03; s, D4 v8 W9 V9 e* u
=========
7 Z7 V: P* h7 |0 Z6 v
) _' r- d; j; _. p# qLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
. G, y1 L" f+ O& }! P1 V0 M0 y(API Get entry point)0 L% }- X+ E& a& m4 P* L
        # A+ R+ Q& X: e- L* f

- ]7 F. C* s9 ?& t8 Q/ c6 g    xor     di,di! h9 T% U: G7 r/ l* L# p3 n% A, a5 N
    mov     es,di" v/ z% D: y+ [0 P2 P% A/ s' q
    mov     ax, 1684h       ( l! J* N# j  k. H2 g! ~
    mov     bx, 0202h       ; VxD ID of winice
4 u/ K4 p: D! a5 c4 D. T    int     2Fh3 `( r# q1 `2 v0 J
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" W3 [  v! w  v8 R    add     ax, di% |9 D0 F9 _: s
    test    ax,ax2 t: C4 h! x3 \' s7 u: w
    jnz     SoftICE_Detected) x4 k2 H8 A. E" c8 d* ~

3 e, v* H" o: }/ r/ T7 H$ y___________________________________________________________________________0 o3 `+ G7 u8 `! f# ]. W
$ k" [$ l. [7 I1 I3 I$ i: w
Method 044 v5 ]5 G, X0 o! S2 U8 B
=========4 k/ m6 g) V/ p" T

' T" @- @3 m$ s6 JMethod identical to the preceding one except that it seeks the ID of SoftICE! H$ q/ F' h3 G
GFX VxD.
& ]7 x, Q( p) r( h) d' h. r6 X( \, U4 v. S& e4 P( N
    xor     di,di! w9 Q3 t( B0 Q2 p' }
    mov     es,di4 a1 P2 K# }) g9 Z1 j  q
    mov     ax, 1684h      
/ ]5 x( E% A3 o2 h    mov     bx, 7a5Fh       ; VxD ID of SIWVID  W1 _8 o: o4 d. \9 }' ?
    int     2fh! y1 m- j# R+ O/ H" Y; S+ d
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 X  c1 a3 U1 }' b5 o1 O- F& D* i    add     ax, di
, I4 _, n% X# A; |    test    ax,ax
0 B; W5 [/ {' k; W  Z9 O5 \    jnz     SoftICE_Detected1 \$ }/ D! Z) M4 g" V
0 Y' A7 l% `  O# @7 u; S: w
__________________________________________________________________________2 q. V  l/ y7 J9 D+ c3 D

( s1 A  ?4 s, m. e6 r8 v- H$ p. w( g8 J5 U" R# J+ n/ t
Method 05, r3 c) R8 j1 y& h0 H- M
=========" ?6 S# W1 X8 v* q  ]3 r, w: F

7 m- l: k- T, L0 N6 m' ]Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 Y. R) J. l( X* [4 Z" a' _0 k8 bdebugger. It calls the int 41h, function 4Fh.& X+ }% \$ R8 E& }
There are several alternatives.  & @- h  }2 G) p% _6 F4 V

$ S7 l# T/ d* T8 r8 n6 `! xThe following one is the simplest:
5 h5 \4 \: M, h# r- [2 h
* ?2 O, D* N8 N! t: n/ j$ Y3 ]% y    mov     ax,4fh
" ^0 O8 k8 _' z1 z% n    int     41h* B  o* B* B* \! V# u  y8 a
    cmp     ax, 0F386
8 m' G- v6 `1 A! p7 p3 b, Y    jz      SoftICE_detected
! x0 n4 n; p, W2 p; F' S# I1 W% U$ K9 U/ R3 K

& d+ h7 Y/ B( P7 mNext method as well as the following one are 2 examples from Stone's ) V! H$ G9 f; M: a$ |9 W
"stn-wid.zip" (www.cracking.net):0 l% \4 V4 U# w& N& h

  \$ q% H0 t; k7 V1 B) n5 V    mov     bx, cs
, |" U  k  f  c3 T, k7 S    lea     dx, int41handler2
5 O+ s5 T# ?* M# @/ |$ l! f+ ]    xchg    dx, es:[41h*4]
3 }7 }8 [# X9 a9 t0 V3 t    xchg    bx, es:[41h*4+2]$ d  n- Q  w9 F
    mov     ax,4fh7 p: G: }) B" f4 _* ^9 D0 Q
    int     41h  m8 b0 _( V$ {' x
    xchg    dx, es:[41h*4]! j/ @3 p& M/ R) j% Q& `3 {5 X8 P& q
    xchg    bx, es:[41h*4+2]& R8 Z" q$ s/ W8 B- H9 I- h; O
    cmp     ax, 0f386h
) }8 D+ B3 y6 w  Y: H+ \: l" Y    jz      SoftICE_detected
0 a9 I7 J* v. V. p+ [1 m
8 R( t) l$ E, x$ Z! Nint41handler2 PROC
+ h8 C! @3 S. d  _* J) M* v& c0 n    iret4 E' P9 B" P1 B$ q5 d. |0 I# \
int41handler2 ENDP# o3 M/ h* z! U2 j% ~8 b  W
9 I  w* s' i; |; V8 O
# @! V  u6 ]2 X9 O! m
_________________________________________________________________________
) V+ O; t: t" P9 Q2 V
5 g5 q( Q  C( v/ `
2 ^3 L3 o6 H2 ^& a' ?0 dMethod 068 d8 r- f7 d) w$ [1 [
=========  P: G& Z: o" j& p! ^2 I7 {4 y4 N1 z

. c: r* Z% W# l& U
3 N6 K; T9 k" W; Q+ t; Q9 v2nd method similar to the preceding one but more difficult to detect:
1 X7 K* h# ]* k  N
" |* m  p: o; y- ~& p/ s
( P8 `. ]2 Y( R: F# F0 |int41handler PROC% d  ^/ I+ c2 C# p( B3 r* y
    mov     cl,al
9 I. |- d: ^" `6 c3 N( v5 G6 A    iret; @) a- O  }) a. e3 |3 `0 i$ y
int41handler ENDP
$ u) l, Z$ c6 C4 B
$ @1 r  d9 x2 [, Q% s/ _1 u" [. W8 T7 i8 V& Q2 H! w
    xor     ax,ax& a/ N1 ^0 {  f/ V4 C  X
    mov     es,ax
8 x  r) D3 k. \) n/ {    mov     bx, cs
2 X. {* D+ t' y, ?0 s4 G    lea     dx, int41handler
2 X9 p" u# M) H/ X7 B+ B# {9 p    xchg    dx, es:[41h*4]- T) w( A0 Y- s8 K, ?& x9 h
    xchg    bx, es:[41h*4+2]
  d% I5 G! ~( x0 P, D    in      al, 40h
! P! U& Y9 |6 p: e6 C! d    xor     cx,cx
4 N* g  Z2 J% [* ^    int     41h1 h8 S( j: D0 h+ k' u
    xchg    dx, es:[41h*4]; m- i) x/ C) X/ P( Q- [
    xchg    bx, es:[41h*4+2]# W/ `" w% A, ^4 O+ ]' d* p% [: N
    cmp     cl,al
# y% g* e1 `5 s1 T    jnz     SoftICE_detected( _1 Q$ s: Z1 V0 z2 [3 A
5 w6 ^% o0 Q) h: ^
_________________________________________________________________________; ?/ P2 k& g$ S# }
' n3 X0 ~4 ~8 t( s: x7 h
Method 07+ @, [+ O. n: C7 t9 h& ~
=========
6 b$ i! L( t1 y$ y( M( l0 e4 y
0 X8 _/ v% ]- z4 n5 H4 ^, L/ \Method of detection of the WinICE handler in the int68h (V86)  X3 [5 u& T4 t# S
7 r; v" M( [. q, S' c' c& u
    mov     ah,43h: k! V0 H' X8 o8 v# {
    int     68h2 W% |" g6 e" i% F1 Z) o  I0 u
    cmp     ax,0F386h
. ?: E4 [4 k2 f5 r. J) U( V    jz      SoftICE_Detected) n% y% p' Q% Y( Z

" z# M- K$ q& J% Y% x6 x* W4 F; O" R& `& ^# E
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; I, @& h) n( z. F
   app like this:5 ~4 p3 i  k8 D0 d

4 s- e; E, d6 v$ f& g. x   BPX exec_int if ax==68
2 Y1 j$ ?$ @- q   (function called is located at byte ptr [ebp+1Dh] and client eip is2 C- M  `) X/ d6 B( [: t" ^
   located at [ebp+48h] for 32Bit apps)
1 O# F9 r( W4 I! f* {4 z/ D__________________________________________________________________________
9 r; k8 s: W  h" P: r- e) p- m
, C3 t2 ^, F& Z& U# K4 e( T& _
0 v* K  Z4 j. u5 ~+ U( O. XMethod 08* e) W1 a  W/ J( h
=========
+ {% Q/ ?, A, `5 D; g" ^% S+ w# h  Q1 w/ d0 t8 j& O: r
It is not a method of detection of SoftICE but a possibility to crash the
1 Z/ `; j+ i* Z& psystem by intercepting int 01h and int 03h and redirecting them to another
) |' c, t( a/ Q5 a* Mroutine.
9 J/ I# t! i; b3 DIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 ?( u* a8 {8 J4 }& T: cto the new routine to execute (hangs computer...). r+ l/ F) l9 s/ `0 @% }7 A  A

/ _$ I+ m9 K$ b& O0 x% W: _    mov     ah, 25h. M% S9 y0 h; B/ F
    mov     al, Int_Number (01h or 03h)
6 m4 e8 f' o, V* \4 L" ?    mov     dx, offset New_Int_Routine3 \/ i7 S0 b. h* H, z
    int     21h1 C  [" s0 y" W8 E; q6 R

3 W# g& r2 q) }' s__________________________________________________________________________& i( _' T7 P1 C; d; }% S1 m) F8 D
: k4 W/ d* D5 Y: w7 F
Method 09: F* `, ~2 X9 o8 b2 l
=========
. n3 L: |8 `' K* f! I. I
; w% v; ]! e9 |, ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 J, ?3 s2 n) r/ N% x1 t
performed in ring0 (VxD or a ring3 app using the VxdCall).0 Y+ V: C$ J+ Y8 o: P% j
The Get_DDB service is used to determine whether or not a VxD is installed$ M1 L) e  `3 J/ G( ]1 k7 k
for the specified device and returns a Device Description Block (in ecx) for
# ?9 N2 ~: b' H( t' r7 B. y$ }that device if it is installed.5 @; m& r+ C7 x4 W" h

( N, i, j* H, H  u4 S   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( |$ d3 ]. r* o1 K   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
" i# V. o- Z( L* F' h# b( E   VMMCall Get_DDB7 J* n+ D) j7 I6 C% a
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  [  m4 L' |- f* H
6 @! B3 f8 \  wNote as well that you can easily detect this method with SoftICE:4 R! R) }! C% \- I3 f( N
   bpx Get_DDB if ax==0202 || ax==7a5fh1 m% B* U7 g* }( C
) R; r8 W' c; n$ y
__________________________________________________________________________' v9 ~- X5 K4 o7 c
2 F0 ~5 z; H8 |) \
Method 100 E  V; q; [7 l; `; e  o
=========4 @4 x5 |' L! j' }& s

" ?! ^" {# K" U; k3 c* {5 R0 C) P=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& h4 p1 k, i6 \4 j+ A$ b* W0 p  o  SoftICE while the option is enable!!
; q  o+ f& c" q* U, T  y0 C4 V5 w0 O; F4 j: ]6 a
This trick is very efficient:
& L2 ]8 a. K# O$ ^+ Y6 o, uby checking the Debug Registers, you can detect if SoftICE is loaded$ A: L8 V! }0 S3 j
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
7 P9 g: \6 b0 T8 ^' lthere are some memory breakpoints set (dr0 to dr3) simply by reading their. s" _8 S3 H$ h  R% K
value (in ring0 only). Values can be manipulated and or changed as well2 b2 g+ N( b& Q# t$ Q; R
(clearing BPMs for instance)5 h7 Y' Y* J& i$ ~6 ^

  _5 r% H2 ?( ^" U6 `" G1 R__________________________________________________________________________) r: W# ?! x# }; ~; w9 g8 n+ h

0 b6 v4 M9 J  g8 nMethod 11! I: }. J; M1 p* m. P
=========
( {: L' E: f  O1 r) u9 O7 s, W9 G* c/ H4 }
This method is most known as 'MeltICE' because it has been freely distributed
8 P8 n% G2 h2 ^1 uvia www.winfiles.com. However it was first used by NuMega people to allow
4 G& p/ i. ]* u7 g0 u8 c7 V5 DSymbol Loader to check if SoftICE was active or not (the code is located
2 v# \- D1 {# b: N% W/ P6 ?inside nmtrans.dll).
) G) I! e  ?5 w7 k' _
1 G; }1 C" {9 O6 DThe way it works is very simple:
/ J" V7 u/ ~( R' p1 U" xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& T1 d3 D, e$ p, p% FWinNT) with the CreateFileA API./ Z& t  d6 F% E

; t! d* g5 S! D5 U* gHere is a sample (checking for 'SICE'):9 t& V. |- N8 W) A8 M
7 u' n+ m, ~+ Q" I% s! u0 ^
BOOL IsSoftIce95Loaded()' ~9 _* v( q$ q6 D1 @9 e' ^6 z
{
% w; Z0 k, N8 ~/ i4 Q& Z   HANDLE hFile;  
# J1 ^8 E9 L" x5 v2 h   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
/ G4 z6 Z1 L& o3 x                      FILE_SHARE_READ | FILE_SHARE_WRITE,
& G+ L! f, ^3 [! m5 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: Q5 U, o/ E2 G   if( hFile != INVALID_HANDLE_VALUE )0 e, {" D" Y* x
   {
1 T3 ^: d# Y( t$ L8 L      CloseHandle(hFile);& H- s0 ~" l2 x7 }
      return TRUE;
( E3 h8 S: O! W% T2 X   }
/ }. V' E( c- N% K1 K   return FALSE;) R& W$ d, P: r; `  G0 P
}4 P5 w6 @5 l4 G8 `, [/ I

0 q/ q: r  ?" W$ h! CAlthough this trick calls the CreateFileA function, don't even expect to be
& Q' L, r* k6 l+ M1 r0 rable to intercept it by installing a IFS hook: it will not work, no way!
* H  E2 I" b* @9 W1 WIn fact, after the call to CreateFileA it will get through VWIN32 0x001F6 j7 H9 u- @( \3 n: j
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# q, K/ E; ]: Z" S9 J. _* j+ [% q, h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 T  K: M5 a# G& R2 w8 \5 g% Ofield.
. N  X- Z4 u2 N. t- ~In fact, its purpose is not to load/unload VxDs but only to send a
% k) Z% _7 g9 g+ D4 n8 X$ uW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
, F4 F- {; ~9 c, ~5 jto the VxD Control_Dispatch proc (how the hell a shareware soft could try/ x+ O9 f* ?* j9 @/ b
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
0 \6 L8 m9 S3 F2 K& fIf the VxD is loaded, it will always clear eax and the Carry flag to allow
2 @" P& K( q5 P6 \its handle to be opened and then, will be detected.2 H7 \' P& B. i2 s" T2 O, ^/ |: [
You can check that simply by hooking Winice.exe control proc entry point7 T# f8 ^6 T- @% T4 b* I1 q8 u
while running MeltICE.2 k& o5 u: z: a! p/ E0 A  I

6 F3 P3 K/ r* |4 E
5 K4 e2 V- y4 I# D( [, |# L  00401067:  push      00402025    ; \\.\SICE
7 Y% Q; g( C1 g+ h) ^$ r9 q: B6 y  0040106C:  call      CreateFileA/ c/ L6 C" J1 g: U& [( ~0 f! p: n
  00401071:  cmp       eax,-001
- r! o2 g, z  Q; V  00401074:  je        00401091
+ p: O) F, X7 T0 U: D8 N
" `( U) ?& e7 X/ w$ q5 {" Z2 \6 k: D4 p9 E9 S" R& W6 H( r/ \" R. H
There could be hundreds of BPX you could use to detect this trick.3 T0 O, y$ T! s* B8 Z8 F
-The most classical one is:" b9 a$ m4 Y0 b$ o# v4 ?* ]" r
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) f4 K$ o# e6 ~; @    *(esp-&gt;4+4)=='NTIC'1 v" i1 |' C) Q1 z; \

; v( p2 z, S/ e4 {2 [6 P) P-The most exotic ones (could be very slooooow :-(" c/ }% k& d; z2 t
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
% Z# U2 E- ~3 n     ;will break 3 times :-(
+ p2 m. f3 Z, E# Q& b1 Y
! i1 L$ F/ z( ?: r( e. \-or (a bit) faster:
( N. ]( _8 H( ?  V, u6 N/ ^& B   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')% i, X0 x4 O: v+ z, i

' _$ O& d  k. L   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! G# C: Z0 W, O2 W3 Z9 _
     ;will break 3 times :-(; ?; o" p$ \% K8 |. L
( p, ^1 p- s0 L& A$ y; R
-Much faster:
9 e; s$ i8 S& k   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. R$ |2 X7 M% h% p& d
, X3 U. @# p* g- ^. W+ _
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 N8 A: u0 Y  w4 `7 g% q% }
function to do the same job:; j2 I# _2 ^$ b1 N: L7 i- @6 V

7 h/ W& _# _6 Y, s7 o   push    00                        ; OF_READ. D  w: `4 W. p5 e
   mov     eax,[00656634]            ; '\\.\SICE',0
% R1 @: V( o( n8 A4 X9 r# Z% c1 u   push    eax  f( V5 t- U( K
   call    KERNEL32!_lopen/ F1 ^8 B8 G- I/ N! Q
   inc     eax
8 j$ R4 }3 l5 \, d' E; P   jnz     00650589                  ; detected
# w  O4 L: q5 V1 F   push    00                        ; OF_READ5 `8 L" d0 U: U/ H1 m& H
   mov     eax,[00656638]            ; '\\.\SICE'# N9 i4 Y, j. a0 M( d" k. q
   push    eax4 c7 p# G2 x, N1 ]! Z* Q! R
   call    KERNEL32!_lopen
" p  i; _& T( Q* ]7 k* Q' }   inc     eax
# Q2 Q8 z- U0 m, A   jz      006505ae                  ; not detected1 t% [& u5 u; U8 m$ t5 N

9 V2 u4 o( Q# d: ]# a: a5 O0 Q+ [' D
__________________________________________________________________________
$ _$ R* ?$ g- t( Y- C7 Q
+ j! ?  R+ U0 d% F) Y4 TMethod 12
& e8 s" X: ^' |! U=========
: o2 Z0 J0 y: U- x) [* \, G+ [& S7 Z/ p9 K& C( n; w1 q
This trick is similar to int41h/4fh Debugger installation check (code 057 A8 c  R8 G$ A5 a4 U
&amp; 06) but very limited because it's only available for Win95/98 (not NT); t( ~3 X/ Y  l. K" U1 N/ y0 _' W7 J
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.6 N, N$ w* p+ W2 ?. ?% @  R1 z
0 D/ W; p. @) f4 e, ?
   push  0000004fh         ; function 4fh
: D1 [' z" l6 [# n% D   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 v3 i8 y: s8 ]0 T& G3 `                           ; low word specifies which service+ T& B* Y- B4 a5 A) S5 U: q
                             (VWIN32_Int41Dispatch)0 e" V/ ?6 O: ~4 [9 U9 {0 k; B
   call  Kernel32!ORD_001  ; VxdCall/ X" l# G, q2 Y& M$ t2 w
   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 {) d. X. x4 C% e& {4 G   jz    SoftICE_detected1 N* ~( {2 ]& l% w
# P$ |) J# U- B( p% K2 C4 f$ [/ w1 e
Here again, several ways to detect it:1 S- |# T/ \5 G5 {- T

, Y! w+ ?# K0 T4 h" f    BPINT 41 if ax==4f$ S) i+ v3 }( V- {, p. k* U: s/ m. @

4 c! j6 c! B6 f0 A    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" G- b8 Y* M) D! O7 Y6 |

7 I: b4 ?: v. ?# E3 u8 [& e+ c    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A8 N( b" V5 _: P* l( q5 _

6 l  J0 h- J% f9 x% |  l( S3 Y    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
- w+ N8 a# Q% X  B. Q6 h- S. ~7 A2 v7 N' G& z) X3 L
__________________________________________________________________________
7 ~# ?2 |' T: h7 I3 r. U, N+ K
6 M( m& Q; a2 k. @" DMethod 13
, i& k2 ?7 u8 ?; O* |4 [=========
8 R- A8 t# Z0 ?! J* k# n% q5 H8 C6 a- E9 D! {6 P0 S
Not a real method of detection, but a good way to know if SoftICE is$ K* T$ U7 h" h# b
installed on a computer and to locate its installation directory.1 K9 U( b0 j: b( V" l& G
It is used by few softs which access the following registry keys (usually #2) :2 v% C0 l6 }, g' |

" Y2 t3 ?5 `! P! J2 F' S-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ E8 f+ p2 W, y6 ?1 L% d4 E! J\Uninstall\SoftICE- |+ O6 |; B- }+ w$ t! d
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; x+ v5 p. w# J, x( F
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' Q: O/ A1 I; n. j( `( C3 R, G6 g1 B
\App Paths\Loader32.Exe
! z" {' ?; J7 W( P$ y, c- g# f* ~
/ I, x( A8 {6 k$ D
Note that some nasty apps could then erase all files from SoftICE directory
/ @$ a$ j/ K9 }# y5 j5 M(I faced that once :-(, r1 d+ I8 {9 V: T2 _
! t/ A' u" e7 W$ ?( c1 [$ a# T
Useful breakpoint to detect it:
% F) ?1 ~& N% X# {4 v$ d" z) F4 e* I9 T" d
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE') E7 _- I& @7 ?0 L+ t
' f9 u" ?9 B7 }  ]
__________________________________________________________________________
2 }5 A8 y+ L7 ]# ?8 G6 E
% G- G* [* W  K: H0 k+ z
1 O1 e8 B" y* VMethod 14
1 Q5 d( c6 e9 }3 `+ N& }=========
+ C$ `- H9 P) W- F7 V  H  Y, M5 B' X# A( ~1 U6 Q$ `
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ p8 ~6 v2 u' nis to determines whether a debugger is running on your system (ring0 only).
3 D: s1 Y2 l& c7 C( j" l! e/ U
& a4 e( ]5 N) n  H: q/ O   VMMCall Test_Debug_Installed& v) l0 S. H8 B) ?
   je      not_installed
0 M# ]1 z) _) a/ z3 x
' J  ^' ]6 A2 ~This service just checks a flag.
( c4 _& P" J3 w4 i</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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