About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 ^$ r$ l) S  k5 c<TBODY>
( r( G0 o& c8 P% \( h<TR>
. Y0 }8 [/ F) H  V<TD><PRE>Method 01
0 f+ q: G9 b  G=========
8 A4 p6 a2 I% V' O9 i4 P% G: A  ~/ W8 c9 f! P+ s0 x" F1 Y1 Z
This method of detection of SoftICE (as well as the following one) is
8 i+ g! C/ V) `8 k0 ^8 ~used by the majority of packers/encryptors found on Internet.2 H1 o2 d8 \7 H4 D
It seeks the signature of BoundsChecker in SoftICE
: t( F" s: W( {$ N3 I8 j& O  D4 R( }) a  D$ ~0 f  X6 G  V
    mov     ebp, 04243484Bh        ; 'BCHK'" M. ?$ ~9 [; D3 i9 x" i
    mov     ax, 04h; ^  }  A- [( y2 ~' l
    int     3      
: Q' m9 k$ y) E2 K8 V$ J. Z' K! G& K    cmp     al,4- H/ @2 a5 o: S+ z8 W. d0 V
    jnz     SoftICE_Detected- L$ D+ ?9 v; B4 Y2 Z

/ }3 V  X9 h- p___________________________________________________________________________
$ o4 l  k, U+ Y$ a9 N& Z8 A' i
Method 02
6 V2 t' w7 u1 o7 y( b=========1 |/ _3 Q! b1 C6 W" X' {7 x
, Q& V: h" e4 p  h  f4 k5 g
Still a method very much used (perhaps the most frequent one).  It is used
# }$ h, a( U- F4 [5 Hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
  `" I+ c8 l3 x# x% ^or execute SoftICE commands...2 @) `7 m( r% C8 F5 m
It is also used to crash SoftICE and to force it to execute any commands
$ C! \# H8 j+ q3 C# \) ?* _(HBOOT...) :-((  7 I, B" j* l/ J' L. V  \

/ B, @/ P- r6 h4 [# `8 u7 ^Here is a quick description:$ s! y! ?7 B% Z: `9 T% T
-AX = 0910h   (Display string in SIce windows)/ i1 j. S: Y8 a9 d- _3 H; q6 |
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 Z/ Q3 o/ z6 |-AX = 0912h   (Get breakpoint infos)
5 g! ^3 Q  {( ]-AX = 0913h   (Set Sice breakpoints)  _" ~  `) V2 E% b! c/ F6 l/ V
-AX = 0914h   (Remove SIce breakoints)& R* j5 F% P6 t/ o

7 N" n# _' Z+ N' w; l7 VEach time you'll meet this trick, you'll see:; D$ y2 f! Y& ^9 @# P6 {
-SI = 4647h( @5 A' G! e/ U
-DI = 4A4Dh
6 Q% Q* Z! [; H) g' T9 aWhich are the 'magic values' used by SoftIce.8 n$ R* a! s" m# z
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( P/ X6 P6 X( F* W$ X
/ Z7 X7 b3 k' FHere is one example from the file "Haspinst.exe" which is the dongle HASP
) U8 m; A0 S4 U7 z1 lEnvelope utility use to protect DOS applications:
( {9 q3 Z, g6 q- Z
' i. i- i, @2 g& |9 K
  w  Q# F# m! h4C19:0095   MOV    AX,0911  ; execute command.. I1 |, j2 X7 _6 a  ~5 n* y5 N3 y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! G+ `. h; e; {5 D, F, s4C19:009A   MOV    SI,4647  ; 1st magic value." w/ z9 v2 f% g% U0 V' z( M
4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ |" B& H8 F% _% Q, R
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
- b/ h5 d) i2 p4 M4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& w3 I2 P- k+ b& A% I3 _$ }$ m% i& U4C19:00A4   INC    CX
# R/ V$ [. r. f6 A4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute( a7 L' v. C) q1 ]. t
4C19:00A8   JB     0095     ; 6 different commands.
% \3 ], `( m( c4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  W( b! k( i! D& Y' ^! t! T+ C4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. |+ [0 x* j2 s4 M6 B# O# i4 n4 a4 s
* G0 l1 R% Z! b% F2 F6 H+ v, MThe program will execute 6 different SIce commands located at ds:dx, which, J( t( j$ i5 m% X% c! N5 t4 s
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
) {! l$ B- ^6 p) {
( s7 x* J; S2 y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
# d. k  i; K& p7 m2 _( K/ V___________________________________________________________________________0 l2 G7 b* S8 T- s' C, p. W
% u2 ?$ {& ]! v) N  d7 |, s
- A& i3 P8 N3 ]4 H3 ]
Method 03$ `2 l1 i4 D3 p4 x1 ?
=========) ^! W2 o2 T( Z( t8 l
' W& T9 J0 e1 o8 W& x: @  B
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h8 q/ u3 I+ L, \
(API Get entry point)
# t, c" e- ~' ~( f1 \' x  m        / k! a9 @3 g. @+ O# ?! x  ]

- f* t$ m, K/ G& s: U; z; Q    xor     di,di
  M3 p( v# a7 a# u2 W$ C, F    mov     es,di
% @6 }+ w2 {: Q. B% W5 c' }: ?    mov     ax, 1684h      
' S' s, E% a! v. J- V    mov     bx, 0202h       ; VxD ID of winice
% H+ f+ l" `! ~" [2 j7 G    int     2Fh* q3 G( N# F: a
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ C9 U2 b/ N, a    add     ax, di
( n8 m, @6 H7 C7 Y  |/ F    test    ax,ax
7 @7 t  A1 c9 t! ?6 R7 N    jnz     SoftICE_Detected
  i1 m: L& I4 z  _6 s, T: }# I1 k$ m" L! f* P5 \! {
___________________________________________________________________________  J/ c  I: v- T, B2 s% m
, X4 L: y, {" ]  m! ~, ~$ }
Method 04
9 V! J' e4 m; b$ T+ v- q% w=========
/ q* y, U: ?! t
& s! i& z  ^! d8 c, H8 Q4 gMethod identical to the preceding one except that it seeks the ID of SoftICE
5 ]- H3 T! Z7 F2 g1 s" K% l% tGFX VxD.
1 |( }6 o+ l5 {6 y, m. B
/ A# K+ l# e/ t: _  w    xor     di,di2 U# b4 {  _1 X  C1 U4 \
    mov     es,di
4 D& p6 s/ H6 t" V, B* n( |- }    mov     ax, 1684h       " {" p. m  e( @* W5 G
    mov     bx, 7a5Fh       ; VxD ID of SIWVID2 I" o2 z1 U$ A
    int     2fh  k. c$ t! X/ |, D# W; W
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; ?+ U8 w/ i+ M% S  Y0 j* r0 T    add     ax, di
* h- ~" G2 r* y3 C3 W9 t" p$ v  U    test    ax,ax
5 |- c( E  ~+ L* W1 T! Y    jnz     SoftICE_Detected, \+ |. g* u5 R* J+ t& _" P

4 |! j. `8 ]; f; G+ a, T__________________________________________________________________________# r3 h  j# [1 y  D& w$ H

7 B: O. f, i: _' I' h  d
  a% S, z9 `8 [Method 05- O3 r" L* G. r0 p% N- y
=========+ @; a, J. h( x. s

) F7 j' R' `- SMethod seeking the 'magic number' 0F386h returned (in ax) by all system& C9 O# k3 a6 d5 B. e# y
debugger. It calls the int 41h, function 4Fh.7 F+ O5 L6 F/ }0 X! v9 O
There are several alternatives.  0 W7 J- X9 p3 e- D+ y7 ?

2 _1 N9 X' y' }, P) \$ [The following one is the simplest:
4 Q7 g6 B! \7 P8 l0 g- @* ]% p6 W1 H8 {# b- G) }
    mov     ax,4fh# D8 X9 M, {  U* L4 L- Y/ n
    int     41h
# I8 S8 O& E# S  K: \% R+ p1 z    cmp     ax, 0F386
, K  X+ @. W! x    jz      SoftICE_detected9 N! ~5 q( ~% d+ C- B( }( H7 ]
5 R) W, b3 S* T, t2 Z

, t* m1 {( {0 G. Q0 @0 wNext method as well as the following one are 2 examples from Stone's
% @/ D: r! S, v6 Y"stn-wid.zip" (www.cracking.net):' d& R& J2 n5 S/ F1 F
0 \0 E! x. A0 V4 q& ~
    mov     bx, cs2 w5 z. E9 G8 p
    lea     dx, int41handler2* L8 D4 m- f3 a
    xchg    dx, es:[41h*4]
+ K$ }, g' t- R9 \( z, T+ L' R9 r    xchg    bx, es:[41h*4+2], {1 G+ F2 O0 L& {# |
    mov     ax,4fh+ r8 n, X; P2 J3 K8 Q3 c
    int     41h
* p* i2 k* Y: q; K. r$ F    xchg    dx, es:[41h*4]( R  s4 c+ F+ e0 r, Q& b
    xchg    bx, es:[41h*4+2]7 |, i& `& C( J( G6 L
    cmp     ax, 0f386h0 Y5 X1 W5 S2 o* ?, N* \
    jz      SoftICE_detected$ k& E/ s1 ]/ k6 n$ k; J
+ U2 m) c* m5 Q* _
int41handler2 PROC4 \& K& U3 Q9 U2 {  x+ T, b
    iret2 [' z5 i% b& S, Z; o) i; b. \
int41handler2 ENDP
3 `2 b; s  r5 t; a: c* K. ^: Z/ }/ l: K& F. e

, _4 \2 [; `- X  r  N% G# O4 C_________________________________________________________________________
' ~& S* d, v$ M6 o2 r) Y4 G  Q0 X
  b" u) t4 m( a7 X0 o& y3 j4 }" M3 o' W+ Q7 i
Method 06. p4 R) T& o8 x" l; J1 \; ~  U
=========& I1 ^% v+ {/ ?. A3 e1 U# n# {

# }! e$ ^) X- P$ Q1 T
. F! k0 Q! i7 ~( _9 h2nd method similar to the preceding one but more difficult to detect:8 ?1 t3 B- O6 j7 U' C: ?( {4 \: ]
! U/ @1 G4 M, E- g' N  L
9 g; s3 ?8 U% B# _
int41handler PROC. b7 Y7 I( S2 t+ _) S$ G
    mov     cl,al
: `+ P$ Y0 k- z5 n  y! |, V    iret. R& Y4 \, M7 Z0 u% C  z' f; _1 t4 ]
int41handler ENDP
0 g' Z& p3 `! g% K) Y  w+ L% |1 x& i& T. E

' _! E. V: q9 D6 U. P- q    xor     ax,ax
' y* |: x0 F. f7 b    mov     es,ax
8 L. M7 Y# z  g4 h" N  i    mov     bx, cs
  @9 S. d( h, s6 |+ R    lea     dx, int41handler
+ _- V7 W+ S3 f: T& @    xchg    dx, es:[41h*4]1 o! X: k7 F% r' o$ a* w2 f8 W: {
    xchg    bx, es:[41h*4+2]
6 B' W8 E9 }' A2 |    in      al, 40h
+ Q9 Y5 K, m1 ?2 q  b4 T1 M- K% ?    xor     cx,cx4 l2 s* D8 V- Q! r# ^( z+ g3 `
    int     41h* R# f" F1 G: z% V
    xchg    dx, es:[41h*4]% e+ k+ M1 V3 e8 h7 j
    xchg    bx, es:[41h*4+2]
9 i2 @% P* v* H! ]- m3 o% S) L+ _    cmp     cl,al$ C$ V( ]. F7 \4 w* f
    jnz     SoftICE_detected
* n6 h8 I. ?7 [6 y# W, C6 N
$ A* h6 Z7 I& B/ @0 K+ U+ Q_________________________________________________________________________
; }6 S& z/ ^+ X3 j! a
6 c- O  X  U$ J' }3 _Method 07
) Y7 q  T# V4 F. r; W) `=========
( v  Z- x/ F* {  Q$ s
3 j2 N2 M" r* b8 y% Z( c4 Z9 g8 eMethod of detection of the WinICE handler in the int68h (V86)3 e" }9 M  b% i+ r8 Q7 [! j
4 o! r, b" [& O, j, Q: t
    mov     ah,43h: K! e" e4 d+ B3 N" g
    int     68h
' N( j- M& X, `1 j/ ^9 k1 P    cmp     ax,0F386h
% u* j& ^7 x$ Z    jz      SoftICE_Detected
4 Q3 m  }9 P) y: y$ o5 k$ A0 R3 y# S: F
' B* s* B% ^1 }3 g7 r' r' F0 \
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 F" X* O; r8 K4 k1 O; W" a( P   app like this:
8 |& O- ~2 @  e: p! G/ J3 q1 [7 f6 k: N7 ~; p
   BPX exec_int if ax==68% L+ Z8 `& I2 j/ y9 _; B
   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ h( M9 F+ u# o   located at [ebp+48h] for 32Bit apps)& i0 b: c, d, d* J
__________________________________________________________________________
- j4 V2 u& Y% F1 U; E5 ~7 O/ F- r. J0 k( E. U2 V

9 _& i" _# _9 E, \4 yMethod 082 h6 t' M2 j0 W9 r
=========0 e5 K! ^$ h$ m1 \

5 ]0 P9 J: h& xIt is not a method of detection of SoftICE but a possibility to crash the% `( j, k5 ?1 s) o; X
system by intercepting int 01h and int 03h and redirecting them to another) n. s4 s2 \- U2 y; |. \
routine.
  i: Q# [" [$ v4 iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 W" h) C, s7 S' X
to the new routine to execute (hangs computer...)" ]& ]! I% h8 ~8 P- f5 ~  n! ~

6 S! t) S( k( \% n$ F0 q3 i, ?    mov     ah, 25h
% r* T) a5 {( I, c0 D: T7 a    mov     al, Int_Number (01h or 03h)
5 y7 n7 {  q* Z! Z! }. ?2 F' g    mov     dx, offset New_Int_Routine
, \  a) _% y( O: k    int     21h
% A) @3 k8 A' h6 x# L/ B" {$ h7 a+ _* y
__________________________________________________________________________3 M" _  y& @/ l) P2 q& y
' C* V) T# Q. c* @* X0 ]( C$ [
Method 09
# V2 T4 V+ A' |7 X7 a4 v=========
2 Y7 J" O1 A. U; P" v3 X& z, O: @. X3 _; ]5 U! T
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 A( Q; D5 ?) H' N& E) q; zperformed in ring0 (VxD or a ring3 app using the VxdCall).) i9 i3 Z3 c$ |( H, i2 ~1 g! I! R1 u! y7 c
The Get_DDB service is used to determine whether or not a VxD is installed$ D1 }6 k! o0 ?8 t: M& r9 ~
for the specified device and returns a Device Description Block (in ecx) for/ A5 a# H8 l% E+ z5 o* X2 e
that device if it is installed.9 L4 o$ u# T6 P
7 }3 t. m' E5 k% T) y# b" m% \
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ i) o" [1 o5 L   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 @$ I1 P7 |' l) q
   VMMCall Get_DDB
0 `' d# i6 ^- b3 J  w   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
. g' ?3 ~4 T2 p7 Z! X" s8 X; s5 J) e$ V: V
Note as well that you can easily detect this method with SoftICE:
# W/ L8 H, T& I1 h1 @+ o  J. x5 f# h# R   bpx Get_DDB if ax==0202 || ax==7a5fh; R; [* u( C, O5 U- j' p, M2 O

5 K# f- c- l8 R2 M9 S3 ^# F& p+ c__________________________________________________________________________
5 |9 c+ v; n+ L1 y: D
2 y6 I* n9 e3 b. p$ E' j* }Method 10: H" T! e# w! U% N' |& \
=========
  H. u! W( f9 r+ G
  O/ H9 f1 T7 ~3 \* n4 _4 a$ R. W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with! ]# a' P% t1 B; @: g$ C
  SoftICE while the option is enable!!- h, P4 O4 [9 H6 i3 _

/ u5 ]. B% J8 n$ J0 A6 yThis trick is very efficient:& V8 @2 y" X5 R% N. ?! Z
by checking the Debug Registers, you can detect if SoftICE is loaded8 R6 x  T: T/ c& u5 x+ b) S
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 o8 h3 n' i3 p4 N# L8 w3 A
there are some memory breakpoints set (dr0 to dr3) simply by reading their
1 Y  u7 y8 S& Z" `value (in ring0 only). Values can be manipulated and or changed as well
) c4 y  J& o# B* u(clearing BPMs for instance)3 N7 h9 E8 `% |  h! U7 x! A' _& q

6 r1 z" X8 n& T- U0 n; J& O__________________________________________________________________________
5 c4 x$ A7 |' t* K! P
* ~2 r3 C) B; R! _! L. H6 S! T$ bMethod 11& |0 Z, Y' S# }4 I8 P/ a
=========7 n& i8 h6 {. D; l

+ X+ @8 @* ]' {3 ~; `9 n4 u' l2 S( RThis method is most known as 'MeltICE' because it has been freely distributed
. O: }6 L+ E, s" d/ t, svia www.winfiles.com. However it was first used by NuMega people to allow+ p6 V7 L% m" Z( G- Q: a
Symbol Loader to check if SoftICE was active or not (the code is located
- V, V( ~1 S3 e  ^7 u+ }" xinside nmtrans.dll).' `8 B& T. u( N$ l: k8 a: e1 j8 Q
7 R' I* Z; I. |, x
The way it works is very simple:
! L/ p1 y9 e9 ^. N- i  CIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for. `; M7 a; g5 C% [, ^3 H& ^
WinNT) with the CreateFileA API.
6 w0 q8 L/ w2 h8 g# J3 ]& v! Q# e3 N* y/ h% H2 A3 h
Here is a sample (checking for 'SICE'):
$ E* g" `; c& I) {2 Z5 o( v% J7 G- P; Z# g, g9 F5 o
BOOL IsSoftIce95Loaded()% w% M0 c5 g2 @
{4 ~/ _  [$ n. f0 @
   HANDLE hFile;  4 E3 e* m' B, Z
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ }3 C0 w* S. Y7 P  ~/ A; X0 P
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 {) Z( c" B% n" l7 M                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  P" F0 b  [. Y7 |5 F$ b
   if( hFile != INVALID_HANDLE_VALUE )0 f" [. v( ~1 V3 n
   {0 I1 Y; N& Z# c/ b, t  L: H( O( S
      CloseHandle(hFile);
' p4 F7 P9 _# I      return TRUE;
9 v+ I& a# ^2 }- p: \   }6 m% I+ i* h# Y) }8 O- r4 k, S" q
   return FALSE;
/ y# }: J; c) p& _7 l+ e}
5 X: y$ r, |2 l- z% Q0 O! K: B& R5 Q1 _# ?" }4 x* s
Although this trick calls the CreateFileA function, don't even expect to be
4 ~) a% c( P* P# v; |+ Yable to intercept it by installing a IFS hook: it will not work, no way!& N& u! R  m& t7 v  ~* ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; V4 V! a( N/ r6 c3 O3 U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)# L' O1 W$ j# x/ }% ^; u
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 n, l7 I# j  K0 Z  {- t0 W3 H1 rfield.
5 N! m  H6 A9 d& y8 ZIn fact, its purpose is not to load/unload VxDs but only to send a & l4 E  ~8 L* Z' p  P
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# o* ]+ p' X/ J" N
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 F4 t: `/ l7 i5 J8 R  C" Sto load/unload a non-dynamically loadable driver such as SoftICE ;-).  Q  q2 p3 L! Z7 U! Q, x
If the VxD is loaded, it will always clear eax and the Carry flag to allow, G" p0 i3 V; C+ |: H# ]6 ?
its handle to be opened and then, will be detected.7 W; W( u$ L  L7 G# u9 K
You can check that simply by hooking Winice.exe control proc entry point
. @0 l: U% b" Vwhile running MeltICE., ]% D2 m9 L5 }  |

( d/ J4 y% H& c6 R6 t- w9 a% x) n2 A4 F5 r8 _  a
  00401067:  push      00402025    ; \\.\SICE4 L. i9 p, m5 r8 {  y
  0040106C:  call      CreateFileA
2 B1 ~9 s9 w7 `4 x$ _  00401071:  cmp       eax,-001! w7 S+ [4 e# Q6 @2 o: ?% V1 P
  00401074:  je        00401091
' V7 ]) d6 M2 ]6 i# T" t$ x% I, D1 ~' f+ A3 M: ]$ W. d5 \
8 {6 \( D, {! V  w4 g2 n
There could be hundreds of BPX you could use to detect this trick., U7 A: v. u' N8 W' i
-The most classical one is:# Y# b( q" X/ D: F5 N+ E% y) B
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ D& }# i7 ^. O& K
    *(esp-&gt;4+4)=='NTIC'
* L# t/ i' n5 v7 C! h' u' b+ S4 C& T& P1 v+ ?0 w* q) d
-The most exotic ones (could be very slooooow :-(" z4 [4 K* O( V+ f+ j+ E
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 A1 h2 L* o  F$ m) B. o
     ;will break 3 times :-(
/ d9 m) S/ v; W8 X
! @7 {! [  P: ~- t  t- o-or (a bit) faster: ! y  J6 u  C  \, v* J1 [1 V$ a+ J
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 x( w2 @- j9 R
  A, O+ L* E% W& E   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 C) m  G; @) s$ i     ;will break 3 times :-(
6 Y) t! T8 [$ f$ G
) A- u7 f& T: z3 Y* w-Much faster:
* J* Z/ m7 H  R& ]% Q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'. Q* n' ]- @" r: h; D' L
7 d% O+ K% G" o8 W7 H' K
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
" [) Q! w& q5 K# p' z1 P- s( ?( \function to do the same job:# I$ Z0 N& R" g: J
& d, o9 ]( J5 ?9 C. k. N+ Q
   push    00                        ; OF_READ
! @/ |! z0 e( y* ?6 H   mov     eax,[00656634]            ; '\\.\SICE',0
) U. E5 S* r; G6 t! A! h3 v  g% ?% T   push    eax( N4 Y  G& \- s6 g4 W5 ?
   call    KERNEL32!_lopen
( V& i; J- i8 _2 O& q   inc     eax  O) I7 m) j8 |) ?% _
   jnz     00650589                  ; detected
/ e  w6 Y! p+ I4 @  s: {   push    00                        ; OF_READ
! r# N3 b4 A" z. f9 _   mov     eax,[00656638]            ; '\\.\SICE'! @! x1 A4 S( f
   push    eax
4 G4 I7 |5 k( `5 W" q+ ^   call    KERNEL32!_lopen# L' O, `# R2 P. e# T" H, g
   inc     eax" m& t% h3 u+ v
   jz      006505ae                  ; not detected1 x" i5 I5 _8 K% V3 _! o8 d
6 M, U6 S; C: D5 e9 f0 f

3 l9 Z- x4 U  L. j3 U2 p: t# @__________________________________________________________________________. q) }* K; n. N! e# w! n

2 N# I( g1 f* ]! {: B+ D$ _Method 12
4 b0 k8 ^: p4 r5 `5 j5 S=========. g# f7 i% Q; T6 C

. H* M, ~. G/ b: }# k9 nThis trick is similar to int41h/4fh Debugger installation check (code 05) Q9 V4 [; L# J8 l, r
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ Z& ^( w, R9 `( {; {as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- T- s" J, p0 ]
) Z/ `; A/ [: Q5 J   push  0000004fh         ; function 4fh2 j4 n! ^! w3 j0 b% V
   push  002a002ah         ; high word specifies which VxD (VWIN32), J6 ]8 P3 O6 p
                           ; low word specifies which service
% H/ Y( v& }' j                             (VWIN32_Int41Dispatch)
: J6 v) Y- n2 |$ j4 |   call  Kernel32!ORD_001  ; VxdCall  k* q% e: R+ [: B, x$ B
   cmp   ax, 0f386h        ; magic number returned by system debuggers' g& B" z  ~# B+ e5 o
   jz    SoftICE_detected
+ |1 P# Z  y7 H6 U, C5 @. y' D# ?( W2 i& B/ p: g
Here again, several ways to detect it:, R0 M9 _6 u3 j7 p# D5 S$ Q9 ]

: i0 s6 a% C; z/ R0 A    BPINT 41 if ax==4f! }* A7 m1 ^9 p. H6 a; u& |, W# N" E' R
1 R4 b. ^6 i' |: I
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 W/ v2 y! e  U( I0 y
" B. u! p9 i/ M  ?7 X' O% i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ w4 S% O# U/ T% t9 S
9 |9 [$ C" B& ]    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
8 o9 \& Q( ]7 h, K: r  T8 T. Q& v& B4 i9 \
__________________________________________________________________________0 o9 J" k) m; K1 R7 G- T/ R

6 L, K, n8 Q8 w! w+ R6 RMethod 13
* ?3 C7 f/ ]/ U4 ~=========
  T1 Y6 l0 @0 F8 u, I! C7 t2 |. t8 s+ M, k% m( ?
Not a real method of detection, but a good way to know if SoftICE is
4 \9 _* W( |+ ~1 W: Xinstalled on a computer and to locate its installation directory.
9 K' w; q8 s) N8 q, {6 QIt is used by few softs which access the following registry keys (usually #2) :% i$ x6 d5 W! q% ^% h2 g

2 s: [" g8 [, E6 w7 m-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ ?; k2 l8 X" \& Z2 M
\Uninstall\SoftICE
* Y( |7 Y1 U$ U-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
+ v+ H) C  s+ p) J: Q; r9 E. p. u-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) h6 J" V9 o- ~4 e
\App Paths\Loader32.Exe2 o2 E/ W  @1 x! F4 t

& d6 Z3 V! o$ s9 h# A, ?0 S' G& z" A
Note that some nasty apps could then erase all files from SoftICE directory
* V# s/ W8 u6 D+ q! I8 o" I(I faced that once :-(
# a8 C1 B" R. ^' q$ m. k0 J) K1 E" S5 S: \. [
Useful breakpoint to detect it:$ d7 q* |8 t* V8 P

1 U5 E$ ^/ ]; u5 I1 X8 b     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ u% t" v* @4 w. ]+ |- q8 L. N
. H  \3 h" o  l) ^3 M
__________________________________________________________________________
) ?6 u1 u8 Q. h3 Q4 S; s
. s! h5 e% }) I3 T7 K$ J2 |
' F: q# b9 C; o1 v. F. CMethod 14
* j/ j( P: _# V=========% m' G! V; [4 V7 R  F( z0 f* z

7 p5 q7 E- y5 @" [" v4 h5 j9 e1 pA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 J5 M$ \5 \& v$ {
is to determines whether a debugger is running on your system (ring0 only).# E4 r" t: X1 v6 H4 Z

9 d7 K$ d' O) r$ C. M, [- ]0 ]   VMMCall Test_Debug_Installed
5 }* w3 F2 Q, |& Q+ U   je      not_installed
, y. Q2 _7 {5 c% ~* c2 O+ e% l
$ _( h/ x6 E& h  SThis service just checks a flag.0 v5 P+ ?6 n/ e8 O. |7 x( l
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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